Commit 0cc30909 authored by Andreas Brandl's avatar Andreas Brandl

Merge branch 'create-merge-request-pipeline-on-chained-merge-ref-ce' into 'master'

CE Backport: Create ActiveRecordModel and table for Merge Train feature

See merge request gitlab-org/gitlab-ce!27879
parents ef440879 827fc3cc
# 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
...@@ -1361,6 +1361,17 @@ ActiveRecord::Schema.define(version: 20190426180107) do ...@@ -1361,6 +1361,17 @@ ActiveRecord::Schema.define(version: 20190426180107) do
t.index ["merge_request_id"], name: "index_merge_requests_closing_issues_on_merge_request_id", using: :btree t.index ["merge_request_id"], name: "index_merge_requests_closing_issues_on_merge_request_id", using: :btree
end end
create_table "merge_trains", force: :cascade do |t|
t.integer "merge_request_id", null: false
t.integer "user_id", null: false
t.integer "pipeline_id"
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.index ["merge_request_id"], name: "index_merge_trains_on_merge_request_id", unique: true, using: :btree
t.index ["pipeline_id"], name: "index_merge_trains_on_pipeline_id", using: :btree
t.index ["user_id"], name: "index_merge_trains_on_user_id", using: :btree
end
create_table "milestones", id: :serial, force: :cascade do |t| create_table "milestones", id: :serial, force: :cascade do |t|
t.string "title", null: false t.string "title", null: false
t.integer "project_id" t.integer "project_id"
...@@ -2514,6 +2525,9 @@ ActiveRecord::Schema.define(version: 20190426180107) do ...@@ -2514,6 +2525,9 @@ ActiveRecord::Schema.define(version: 20190426180107) do
add_foreign_key "merge_requests", "users", column: "updated_by_id", name: "fk_641731faff", on_delete: :nullify add_foreign_key "merge_requests", "users", column: "updated_by_id", name: "fk_641731faff", on_delete: :nullify
add_foreign_key "merge_requests_closing_issues", "issues", on_delete: :cascade add_foreign_key "merge_requests_closing_issues", "issues", on_delete: :cascade
add_foreign_key "merge_requests_closing_issues", "merge_requests", on_delete: :cascade add_foreign_key "merge_requests_closing_issues", "merge_requests", on_delete: :cascade
add_foreign_key "merge_trains", "ci_pipelines", column: "pipeline_id", on_delete: :nullify
add_foreign_key "merge_trains", "merge_requests", on_delete: :cascade
add_foreign_key "merge_trains", "users", on_delete: :cascade
add_foreign_key "milestones", "namespaces", column: "group_id", name: "fk_95650a40d4", on_delete: :cascade add_foreign_key "milestones", "namespaces", column: "group_id", name: "fk_95650a40d4", on_delete: :cascade
add_foreign_key "milestones", "projects", name: "fk_9bd0a0c791", on_delete: :cascade add_foreign_key "milestones", "projects", name: "fk_9bd0a0c791", on_delete: :cascade
add_foreign_key "note_diff_files", "notes", column: "diff_note_id", on_delete: :cascade add_foreign_key "note_diff_files", "notes", column: "diff_note_id", on_delete: :cascade
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment