gitlab-org--gitlab-foss/db/migrate/20190315191339_create_merge_request_assignees_table.rb
Oswaldo Ferreira 929ee4d18d Add multiple assignees migration and table population
This will be further required for supporting multi-assignees MRs
2019-03-25 19:50:40 -03:00

22 lines
658 B
Ruby

# frozen_string_literal: true
class CreateMergeRequestAssigneesTable < ActiveRecord::Migration[5.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_merge_request_assignees_on_merge_request_id_and_user_id'
def up
create_table :merge_request_assignees do |t|
t.references :user, foreign_key: { on_delete: :cascade }, index: true, null: false
t.references :merge_request, foreign_key: { on_delete: :cascade }, null: false
end
add_index :merge_request_assignees, [:merge_request_id, :user_id], unique: true, name: INDEX_NAME
end
def down
drop_table :merge_request_assignees
end
end