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

20231220150143_remove_organizations_organization_users_organization_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: 75bf5d3ead90ac06fda9e391c2ed239d3bff8671 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

class RemoveOrganizationsOrganizationUsersOrganizationIdFk < Gitlab::Database::Migration[2.2]
  milestone '16.8'
  disable_ddl_transaction!

  FOREIGN_KEY_NAME = "fk_8471abad75"

  def up
    with_lock_retries do
      remove_foreign_key_if_exists(:organization_users, :organizations,
        name: FOREIGN_KEY_NAME, reverse_lock_order: true)
    end
  end

  def down
    add_concurrent_foreign_key(:organization_users, :organizations,
      name: FOREIGN_KEY_NAME, column: :organization_id,
      target_column: :id, on_delete: :cascade)
  end
end