diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2018-12-06 11:23:36 +0000 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2018-12-06 11:23:36 +0000 |
commit | cebd595eaaf86f04015011bfb4e173cfa797479c (patch) | |
tree | 792c9e3bdff4fb5296e1ab69e444f7622f937614 /db | |
parent | 28951d56b35cd758b73bf56a79dd8ba94e1dc15b (diff) | |
parent | 0e8b9c4a1ecbd3e52ba379494872e019ec7edfe1 (diff) | |
download | gitlab-ce-cebd595eaaf86f04015011bfb4e173cfa797479c.tar.gz |
Merge branch 'partial-index-for-merge_request_id' into 'master'
Use partial index on `merge_request_id`
Closes #54913
See merge request gitlab-org/gitlab-ce!23609
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20181120091639_add_foreign_key_to_ci_pipelines_merge_requests.rb | 4 | ||||
-rw-r--r-- | db/schema.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/db/migrate/20181120091639_add_foreign_key_to_ci_pipelines_merge_requests.rb b/db/migrate/20181120091639_add_foreign_key_to_ci_pipelines_merge_requests.rb index c2b5b239279..03f677a4678 100644 --- a/db/migrate/20181120091639_add_foreign_key_to_ci_pipelines_merge_requests.rb +++ b/db/migrate/20181120091639_add_foreign_key_to_ci_pipelines_merge_requests.rb @@ -8,7 +8,7 @@ class AddForeignKeyToCiPipelinesMergeRequests < ActiveRecord::Migration disable_ddl_transaction! def up - add_concurrent_index :ci_pipelines, :merge_request_id + add_concurrent_index :ci_pipelines, :merge_request_id, where: 'merge_request_id IS NOT NULL' add_concurrent_foreign_key :ci_pipelines, :merge_requests, column: :merge_request_id, on_delete: :cascade end @@ -17,6 +17,6 @@ class AddForeignKeyToCiPipelinesMergeRequests < ActiveRecord::Migration remove_foreign_key :ci_pipelines, :merge_requests end - remove_concurrent_index :ci_pipelines, :merge_request_id + remove_concurrent_index :ci_pipelines, :merge_request_id, where: 'merge_request_id IS NOT NULL' end end diff --git a/db/schema.rb b/db/schema.rb index c6088d3795f..a7d43fb742b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -478,7 +478,7 @@ ActiveRecord::Schema.define(version: 20181129104944) do t.integer "iid" t.integer "merge_request_id" t.index ["auto_canceled_by_id"], name: "index_ci_pipelines_on_auto_canceled_by_id", using: :btree - t.index ["merge_request_id"], name: "index_ci_pipelines_on_merge_request_id", using: :btree + t.index ["merge_request_id"], name: "index_ci_pipelines_on_merge_request_id", where: "(merge_request_id IS NOT NULL)", using: :btree t.index ["pipeline_schedule_id"], name: "index_ci_pipelines_on_pipeline_schedule_id", using: :btree t.index ["project_id", "iid"], name: "index_ci_pipelines_on_project_id_and_iid", unique: true, where: "(iid IS NOT NULL)", using: :btree t.index ["project_id", "ref", "status", "id"], name: "index_ci_pipelines_on_project_id_and_ref_and_status_and_id", using: :btree |