blob: a7f67a3b5cd7824ba55addd04abe3a76af3fac16 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# frozen_string_literal: true
class AddProjectsForeignKeyToNamespaces < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
FK_NAME = 'fk_projects_namespace_id'
def up
with_lock_retries do
add_foreign_key(
:projects,
:namespaces,
column: :namespace_id,
on_delete: :restrict,
validate: false,
name: FK_NAME
)
end
end
def down
with_lock_retries do
remove_foreign_key_if_exists :projects, column: :namespace_id, name: FK_NAME
end
end
end
|