summaryrefslogtreecommitdiff
path: root/db/migrate/20191128145233_add_fk_to_ci_resource_groups_project_id.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20191128145233_add_fk_to_ci_resource_groups_project_id.rb')
-rw-r--r--db/migrate/20191128145233_add_fk_to_ci_resource_groups_project_id.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20191128145233_add_fk_to_ci_resource_groups_project_id.rb b/db/migrate/20191128145233_add_fk_to_ci_resource_groups_project_id.rb
new file mode 100644
index 00000000000..bb23012ea9b
--- /dev/null
+++ b/db/migrate/20191128145233_add_fk_to_ci_resource_groups_project_id.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddFkToCiResourceGroupsProjectId < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :ci_resource_groups, :projects, column: :project_id, on_delete: :cascade
+ end
+
+ def down
+ remove_foreign_key_if_exists :ci_resource_groups, column: :project_id
+ end
+end