diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20190611161641_add_target_project_id_to_merge_trains.rb | 14 | ||||
-rw-r--r-- | db/schema.rb | 6 |
2 files changed, 19 insertions, 1 deletions
diff --git a/db/migrate/20190611161641_add_target_project_id_to_merge_trains.rb b/db/migrate/20190611161641_add_target_project_id_to_merge_trains.rb new file mode 100644 index 00000000000..c200208e4c3 --- /dev/null +++ b/db/migrate/20190611161641_add_target_project_id_to_merge_trains.rb @@ -0,0 +1,14 @@ +# 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 diff --git a/db/schema.rb b/db/schema.rb index 22d0cddb7a0..1755730bb72 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # 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 enable_extension "plpgsql" @@ -1387,8 +1387,11 @@ ActiveRecord::Schema.define(version: 20190530154715) do t.integer "pipeline_id" t.datetime_with_timezone "created_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 ["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 end @@ -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_trains", "ci_pipelines", column: "pipeline_id", on_delete: :nullify 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 "milestones", "namespaces", column: "group_id", name: "fk_95650a40d4", on_delete: :cascade add_foreign_key "milestones", "projects", name: "fk_9bd0a0c791", on_delete: :cascade |