gitlab-org--gitlab-foss/db/migrate/20190418182545_create_merge_request_trains_table.rb
Shinya Maeda 827fc3ccb9 Create ActiveRecordModel and table for Merge Train feature
This database table and AR model is going to be used for
the merge train feature.
2019-05-06 15:12:41 +07:00

18 lines
658 B
Ruby

# frozen_string_literal: true
class CreateMergeRequestTrainsTable < ActiveRecord::Migration[5.1]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def change
create_table :merge_trains, id: :bigserial do |t|
t.references :merge_request, foreign_key: { on_delete: :cascade }, type: :integer, index: false, null: false
t.references :user, foreign_key: { on_delete: :cascade }, type: :integer, null: false
t.references :pipeline, foreign_key: { to_table: :ci_pipelines, on_delete: :nullify }, type: :integer
t.timestamps_with_timezone null: false
t.index [:merge_request_id], unique: true
end
end
end