summaryrefslogtreecommitdiff
path: root/db/migrate/20220211125954_create_related_epic_links.rb
blob: c06a68a9dd2a12ff7a1a43729e4ab4f43aab490e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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