diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-09 06:09:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-09 06:09:24 +0300 |
commit | a25cab22f84ee674ebb32625a6da566acd454e8a (patch) | |
tree | f52667dd7f61cace3157fd55c1485cc2becbe3e3 /db | |
parent | 77914793a349059bf523b131fc925b34349d6884 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20201201034258_add_index_for_non_system_noteables.rb | 24 | ||||
-rw-r--r-- | db/migrate/20201208181411_remove_temporary_blocking_issues_index.rb | 21 | ||||
-rw-r--r-- | db/schema_migrations/20201201034258 | 1 | ||||
-rw-r--r-- | db/schema_migrations/20201208181411 | 1 | ||||
-rw-r--r-- | db/structure.sql | 8 |
5 files changed, 48 insertions, 7 deletions
diff --git a/db/migrate/20201201034258_add_index_for_non_system_noteables.rb b/db/migrate/20201201034258_add_index_for_non_system_noteables.rb new file mode 100644 index 00000000000..5927463e767 --- /dev/null +++ b/db/migrate/20201201034258_add_index_for_non_system_noteables.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class AddIndexForNonSystemNoteables < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + LEGACY_INDEX_NAME = "index_notes_on_noteable_id_and_noteable_type" + NEW_INDEX_NAME = "index_notes_on_noteable_id_and_noteable_type_and_system" + + def up + add_concurrent_index :notes, [:noteable_id, :noteable_type, :system], name: NEW_INDEX_NAME + + remove_concurrent_index_by_name :notes, LEGACY_INDEX_NAME + end + + def down + add_concurrent_index :notes, [:noteable_id, :noteable_type], name: LEGACY_INDEX_NAME + + remove_concurrent_index_by_name :notes, NEW_INDEX_NAME + end +end diff --git a/db/migrate/20201208181411_remove_temporary_blocking_issues_index.rb b/db/migrate/20201208181411_remove_temporary_blocking_issues_index.rb new file mode 100644 index 00000000000..ea63d2d1ed3 --- /dev/null +++ b/db/migrate/20201208181411_remove_temporary_blocking_issues_index.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class RemoveTemporaryBlockingIssuesIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name(:issue_links, 'tmp_idx_blocking_type_links') + remove_concurrent_index_by_name(:issue_links, 'tmp_idx_blocked_by_type_links') + remove_concurrent_index_by_name(:issues, 'tmp_idx_index_issues_with_outdate_blocking_count') + end + + def down + add_concurrent_index :issue_links, [:source_id], where: 'link_type = 1', name: 'tmp_idx_blocking_type_links' + add_concurrent_index :issue_links, [:target_id], where: 'link_type = 2', name: 'tmp_idx_blocked_by_type_links' + add_concurrent_index :issues, :id, where: '(state_id = 1 AND blocking_issues_count = 0)', name: 'tmp_idx_index_issues_with_outdate_blocking_count' + end +end diff --git a/db/schema_migrations/20201201034258 b/db/schema_migrations/20201201034258 new file mode 100644 index 00000000000..6cf3caf2a06 --- /dev/null +++ b/db/schema_migrations/20201201034258 @@ -0,0 +1 @@ +12cc1beb73bcc31f6546066842913284aabba22ea4e93095271c0cfdacfd0858
\ No newline at end of file diff --git a/db/schema_migrations/20201208181411 b/db/schema_migrations/20201208181411 new file mode 100644 index 00000000000..951925cef9d --- /dev/null +++ b/db/schema_migrations/20201208181411 @@ -0,0 +1 @@ +7bbd0cfb98c3e051942bf062444d2586588fe029d9a9548f0e50e0fbad10a490
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 477f6b01747..bf32f40d436 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -21795,7 +21795,7 @@ CREATE INDEX index_notes_on_line_code ON notes USING btree (line_code); CREATE INDEX index_notes_on_note_trigram ON notes USING gin (note gin_trgm_ops); -CREATE INDEX index_notes_on_noteable_id_and_noteable_type ON notes USING btree (noteable_id, noteable_type); +CREATE INDEX index_notes_on_noteable_id_and_noteable_type_and_system ON notes USING btree (noteable_id, noteable_type, system); CREATE INDEX index_notes_on_project_id_and_id_and_system_false ON notes USING btree (project_id, id) WHERE (NOT system); @@ -22837,12 +22837,6 @@ CREATE UNIQUE INDEX term_agreements_unique_index ON term_agreements USING btree CREATE INDEX tmp_build_stage_position_index ON ci_builds USING btree (stage_id, stage_idx) WHERE (stage_idx IS NOT NULL); -CREATE INDEX tmp_idx_blocked_by_type_links ON issue_links USING btree (target_id) WHERE (link_type = 2); - -CREATE INDEX tmp_idx_blocking_type_links ON issue_links USING btree (source_id) WHERE (link_type = 1); - -CREATE INDEX tmp_idx_index_issues_with_outdate_blocking_count ON issues USING btree (id) WHERE ((state_id = 1) AND (blocking_issues_count = 0)); - CREATE INDEX tmp_index_for_email_unconfirmation_migration ON emails USING btree (id) WHERE (confirmed_at IS NOT NULL); CREATE UNIQUE INDEX unique_merge_request_metrics_by_merge_request_id ON merge_request_metrics USING btree (merge_request_id); |