summaryrefslogtreecommitdiff
path: root/db/migrate/20221031102916_add_users_foreign_key_to_projects.rb
blob: fb37b3b37c22f401d55b2ba9a1eb23d403e53797 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

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

  def up
    add_concurrent_foreign_key :projects, :users, column: :creator_id, on_delete: :nullify, validate: false
  end

  def down
    with_lock_retries do
      remove_foreign_key_if_exists :projects, column: :creator_id
    end
  end
end