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

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

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

  def down
    add_concurrent_foreign_key :clusters_integration_elasticstack, :clusters,
      column: :cluster_id, on_delete: :cascade, name: 'fk_rails_cc5ba8f658'
  end
end