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

class RemoveForeignKeyInClustersApplicationsElasticStacks < Gitlab::Database::Migration[2.0]
  disable_ddl_transaction!

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

  def down
    add_concurrent_foreign_key :clusters_applications_elastic_stacks, :clusters,
      column: :cluster_id, on_delete: :cascade, name: 'fk_rails_026f219f46'
  end
end