diff options
author | Shinya Maeda <shinya@gitlab.com> | 2019-06-11 12:34:02 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2019-06-11 14:48:52 +0300 |
commit | abcbeae9a72b393ea7c91bc74586b8359c7e3950 (patch) | |
tree | 1d26265ffad0dd89ea0925adb0aa0e5d67579cb3 /db/migrate | |
parent | c327d02bd2e0e6b96c3c8448e043040914590b4d (diff) |
Persist target project id and target branch in merge trains table
In order to optimize the query performance, we should use target
project id and target branch intead of cross-joining merge_requests
table.
Fix schema
Fix schema
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20190611161641_add_target_project_id_to_merge_trains.rb | 14 |
1 files changed, 14 insertions, 0 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 |