summaryrefslogtreecommitdiff
path: root/db/post_migrate/20230223093704_add_foreign_key_on_creator_id_on_projects.rb
blob: 68fd6de3f230f57e4310bf14981e9c698c746768 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

class AddForeignKeyOnCreatorIdOnProjects < Gitlab::Database::Migration[2.1]
  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