Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20220126210022_re_remove_projects_ci_builds_project_id_fk.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2a026388bbf5a4bec7e19874fe8351d2669fddd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

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

  def up
    return unless foreign_key_exists?(:ci_builds, :projects, name: "fk_befce0568a")

    with_lock_retries do
      execute('LOCK projects, ci_builds IN ACCESS EXCLUSIVE MODE') if transaction_open?

      remove_foreign_key_if_exists(:ci_builds, :projects, name: "fk_befce0568a")
    end
  end

  def down
    # no-op, since the FK will be added via rollback by prior-migration
  end
end