summaryrefslogtreecommitdiff
path: root/db/migrate/20220211125954_create_related_epic_links.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20220211125954_create_related_epic_links.rb')
-rw-r--r--db/migrate/20220211125954_create_related_epic_links.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20220211125954_create_related_epic_links.rb b/db/migrate/20220211125954_create_related_epic_links.rb
new file mode 100644
index 00000000000..c06a68a9dd2
--- /dev/null
+++ b/db/migrate/20220211125954_create_related_epic_links.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class CreateRelatedEpicLinks < Gitlab::Database::Migration[1.0]
+ def up
+ create_table :related_epic_links do |t|
+ t.references :source, index: true, foreign_key: { to_table: :epics, on_delete: :cascade }, null: false
+ t.references :target, index: true, foreign_key: { to_table: :epics, on_delete: :cascade }, null: false
+ t.timestamps_with_timezone null: false
+ t.integer :link_type, null: false, default: 0, limit: 2
+
+ t.index [:source_id, :target_id], unique: true
+ end
+ end
+
+ def down
+ drop_table :related_epic_links
+ end
+end