diff options
author | Nick Thomas <nick@gitlab.com> | 2019-04-12 17:08:04 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-05-03 23:22:01 +0100 |
commit | df778038981ae49cb7c0fec0a60f89abf801c5f0 (patch) | |
tree | f1b158fcc766bce6d70de1157169eac50271bb47 /db | |
parent | 96aa083854f8204a80851017ba547ea3b732e273 (diff) | |
download | gitlab-ce-df778038981ae49cb7c0fec0a60f89abf801c5f0.tar.gz |
Backport of initial merge request blocks supportce-9688-mr-merge-order
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20190412155659_add_merge_request_blocks.rb | 25 | ||||
-rw-r--r-- | db/schema.rb | 11 |
2 files changed, 36 insertions, 0 deletions
diff --git a/db/migrate/20190412155659_add_merge_request_blocks.rb b/db/migrate/20190412155659_add_merge_request_blocks.rb new file mode 100644 index 00000000000..9e7f370d1cf --- /dev/null +++ b/db/migrate/20190412155659_add_merge_request_blocks.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class AddMergeRequestBlocks < ActiveRecord::Migration[5.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :merge_request_blocks, id: :bigserial do |t| + t.references :blocking_merge_request, + index: false, null: false, + foreign_key: { to_table: :merge_requests, on_delete: :cascade } + + t.references :blocked_merge_request, + index: true, null: false, + foreign_key: { to_table: :merge_requests, on_delete: :cascade } + + t.index [:blocking_merge_request_id, :blocked_merge_request_id], + unique: true, + name: 'index_mr_blocks_on_blocking_and_blocked_mr_ids' + + t.timestamps_with_timezone + end + end +end diff --git a/db/schema.rb b/db/schema.rb index de9e6f0b40d..501cb96d479 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1223,6 +1223,15 @@ ActiveRecord::Schema.define(version: 20190426180107) do t.index ["user_id"], name: "index_merge_request_assignees_on_user_id", using: :btree end + create_table "merge_request_blocks", force: :cascade do |t| + t.integer "blocking_merge_request_id", null: false + t.integer "blocked_merge_request_id", null: false + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false + t.index ["blocked_merge_request_id"], name: "index_merge_request_blocks_on_blocked_merge_request_id", using: :btree + t.index ["blocking_merge_request_id", "blocked_merge_request_id"], name: "index_mr_blocks_on_blocking_and_blocked_mr_ids", unique: true, using: :btree + end + create_table "merge_request_diff_commits", id: false, force: :cascade do |t| t.datetime_with_timezone "authored_date" t.datetime_with_timezone "committed_date" @@ -2496,6 +2505,8 @@ ActiveRecord::Schema.define(version: 20190426180107) do add_foreign_key "members", "users", name: "fk_2e88fb7ce9", on_delete: :cascade add_foreign_key "merge_request_assignees", "merge_requests", on_delete: :cascade add_foreign_key "merge_request_assignees", "users", on_delete: :cascade + add_foreign_key "merge_request_blocks", "merge_requests", column: "blocked_merge_request_id", on_delete: :cascade + add_foreign_key "merge_request_blocks", "merge_requests", column: "blocking_merge_request_id", on_delete: :cascade add_foreign_key "merge_request_diff_commits", "merge_request_diffs", on_delete: :cascade add_foreign_key "merge_request_diff_files", "merge_request_diffs", on_delete: :cascade add_foreign_key "merge_request_diffs", "merge_requests", name: "fk_8483f3258f", on_delete: :cascade |