summaryrefslogtreecommitdiff
path: root/db/migrate/20201126190039_add_epic_board_labels.rb
blob: 519e705ce1432994a7115acf60124f0ad5bbbbd7 (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
# frozen_string_literal: true

class AddEpicBoardLabels < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    with_lock_retries do
      create_table :boards_epic_board_labels do |t|
        t.references :epic_board, index: true, foreign_key: { to_table: :boards_epic_boards, on_delete: :cascade }, null: false
        t.references :label, index: true, foreign_key: { on_delete: :cascade }, null: false
      end
    end
  end

  def down
    with_lock_retries do
      drop_table :boards_epic_board_labels
    end
  end
end