Commit fc27c93e authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'add-target-project-and-branch-to-merge-trains' into 'master'

Persist target project id and target branch in merge trains table

See merge request gitlab-org/gitlab-ce!29466
parents 0899537e abcbeae9
# frozen_string_literal: true
class AddTargetProjectIdToMergeTrains < ActiveRecord::Migration[5.1]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def change
# rubocop: disable Rails/NotNullColumn
add_reference :merge_trains, :target_project, null: false, index: true, foreign_key: { on_delete: :cascade, to_table: :projects }, type: :integer
add_column :merge_trains, :target_branch, :text, null: false
# rubocop: enable Rails/NotNullColumn
end
end
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20190530154715) do ActiveRecord::Schema.define(version: 20190611161641) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -1387,8 +1387,11 @@ ActiveRecord::Schema.define(version: 20190530154715) do ...@@ -1387,8 +1387,11 @@ ActiveRecord::Schema.define(version: 20190530154715) do
t.integer "pipeline_id" t.integer "pipeline_id"
t.datetime_with_timezone "created_at", null: false t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false t.datetime_with_timezone "updated_at", null: false
t.integer "target_project_id", null: false
t.text "target_branch", null: false
t.index ["merge_request_id"], name: "index_merge_trains_on_merge_request_id", unique: true, using: :btree 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 ["pipeline_id"], name: "index_merge_trains_on_pipeline_id", using: :btree
t.index ["target_project_id"], name: "index_merge_trains_on_target_project_id", using: :btree
t.index ["user_id"], name: "index_merge_trains_on_user_id", using: :btree t.index ["user_id"], name: "index_merge_trains_on_user_id", using: :btree
end end
...@@ -2570,6 +2573,7 @@ ActiveRecord::Schema.define(version: 20190530154715) do ...@@ -2570,6 +2573,7 @@ ActiveRecord::Schema.define(version: 20190530154715) do
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", "ci_pipelines", column: "pipeline_id", on_delete: :nullify
add_foreign_key "merge_trains", "merge_requests", on_delete: :cascade add_foreign_key "merge_trains", "merge_requests", on_delete: :cascade
add_foreign_key "merge_trains", "projects", column: "target_project_id", on_delete: :cascade
add_foreign_key "merge_trains", "users", 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
......
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