diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2019-05-08 16:05:46 +0300 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2019-05-08 16:05:46 +0300 |
commit | 603412af27346f1541971c674b97d8dbf2429dd0 (patch) | |
tree | 7b74501585990b6460318c4c655e7656a4fe426c | |
parent | 3f6f40b34705cc4d24a3d618117dff106e4d0ca0 (diff) | |
parent | df778038981ae49cb7c0fec0a60f89abf801c5f0 (diff) |
Merge branch 'ce-9688-mr-merge-order' into 'master'
CE backport of merge request blocks - backend MVC
See merge request gitlab-org/gitlab-ce!27323
-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 1be3afd5282..159e7e03cf4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1227,6 +1227,15 @@ ActiveRecord::Schema.define(version: 20190506135400) 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" @@ -2514,6 +2523,8 @@ ActiveRecord::Schema.define(version: 20190506135400) 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 |