summaryrefslogtreecommitdiff
path: root/db/post_migrate/20211118130836_drop_pages_deployments_builds_fk.rb
blob: 5eb532f2a00c4826c6ccb71510f34aa6ec08bfff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

class DropPagesDeploymentsBuildsFk < Gitlab::Database::Migration[1.0]
  disable_ddl_transaction!

  FK_NAME = 'fk_rails_c3a90cf29b'

  def up
    remove_foreign_key_if_exists(:pages_deployments, :ci_builds, name: FK_NAME)
  end

  def down
    add_concurrent_foreign_key(
      :pages_deployments,
      :ci_builds,
      name: FK_NAME,
      column: :ci_build_id,
      target_column: :id,
      on_delete: :nullify
    )
  end
end