summaryrefslogtreecommitdiff
path: root/db/post_migrate/20230412201539_remove_clusters_applications_crossplane_fk.rb
blob: 46687466be7790a7ef2370ce94f151a791693fa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

class RemoveClustersApplicationsCrossplaneFk < Gitlab::Database::Migration[2.1]
  disable_ddl_transaction!

  def up
    with_lock_retries do
      remove_foreign_key_if_exists(:clusters_applications_crossplane, column: :cluster_id)
    end
  end

  def down
    add_concurrent_foreign_key :clusters_applications_crossplane, :clusters,
      column: :cluster_id, on_delete: :cascade, name: 'fk_rails_87186702df'
  end
end