diff options
author | Drew Blessing <drew@gitlab.com> | 2017-12-04 22:00:57 +0300 |
---|---|---|
committer | Drew Blessing <drew@gitlab.com> | 2018-01-16 01:45:56 +0300 |
commit | 38e9e934f49115021614b66353bbac459b6b70bb (patch) | |
tree | 4781a6052478f9197604b78533e6dec0ac4d372a /db | |
parent | 4b99bee09602ea0cb950347187b5fdf6d39603b8 (diff) |
Last push widget will show banner for new pushes to previously merged branch
Previously, the last push widget would only show when the branch never had
a merge request associated with it - even merged or closed ones. Now the
widget will disregard merge requests that are merged or closed.
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20171207185153_add_merge_request_state_index.rb | 18 | ||||
-rw-r--r-- | db/schema.rb | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20171207185153_add_merge_request_state_index.rb b/db/migrate/20171207185153_add_merge_request_state_index.rb new file mode 100644 index 00000000000..72f846c5c38 --- /dev/null +++ b/db/migrate/20171207185153_add_merge_request_state_index.rb @@ -0,0 +1,18 @@ +class AddMergeRequestStateIndex < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :merge_requests, [:source_project_id, :source_branch], + where: "state = 'opened'", + name: 'index_merge_requests_on_source_project_and_branch_state_opened' + end + + def down + remove_concurrent_index_by_name :merge_requests, + 'index_merge_requests_on_source_project_and_branch_state_opened' + end +end diff --git a/db/schema.rb b/db/schema.rb index f47accca21a..a32d20b8f28 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1109,6 +1109,7 @@ ActiveRecord::Schema.define(version: 20180105212544) do add_index "merge_requests", ["merge_user_id"], name: "index_merge_requests_on_merge_user_id", where: "(merge_user_id IS NOT NULL)", using: :btree add_index "merge_requests", ["milestone_id"], name: "index_merge_requests_on_milestone_id", using: :btree add_index "merge_requests", ["source_branch"], name: "index_merge_requests_on_source_branch", using: :btree + add_index "merge_requests", ["source_project_id", "source_branch"], name: "index_merge_requests_on_source_project_and_branch_state_opened", where: "((state)::text = 'opened'::text)", using: :btree add_index "merge_requests", ["source_project_id", "source_branch"], name: "index_merge_requests_on_source_project_id_and_source_branch", using: :btree add_index "merge_requests", ["target_branch"], name: "index_merge_requests_on_target_branch", using: :btree add_index "merge_requests", ["target_project_id", "iid"], name: "index_merge_requests_on_target_project_id_and_iid", unique: true, using: :btree |