diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-11 21:18:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-11 21:18:58 +0300 |
commit | e57809ded8e4e64c0528d33a5f59e9160e310d14 (patch) | |
tree | e51a328a522b165b6b2465529b0adae0272b03dd /db | |
parent | ec377e41624fb83f0e5e51286c7aad24a22eefb1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
5 files changed, 37 insertions, 0 deletions
diff --git a/db/migrate/20220128194722_add_index_on_migration_state_and_import_done_at_to_container_repositories.rb b/db/migrate/20220128194722_add_index_on_migration_state_and_import_done_at_to_container_repositories.rb new file mode 100644 index 00000000000..6c9fb20bbbd --- /dev/null +++ b/db/migrate/20220128194722_add_index_on_migration_state_and_import_done_at_to_container_repositories.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class AddIndexOnMigrationStateAndImportDoneAtToContainerRepositories < Gitlab::Database::Migration[1.0] + INDEX_NAME = 'index_container_repositories_on_migration_state_import_done_at' + disable_ddl_transaction! + + def up + add_concurrent_index :container_repositories, [:migration_state, :migration_import_done_at], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :container_repositories, INDEX_NAME + end +end diff --git a/db/migrate/20220204154220_add_index_on_greatest_done_at_to_container_repositories.rb b/db/migrate/20220204154220_add_index_on_greatest_done_at_to_container_repositories.rb new file mode 100644 index 00000000000..455a8478cc4 --- /dev/null +++ b/db/migrate/20220204154220_add_index_on_greatest_done_at_to_container_repositories.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexOnGreatestDoneAtToContainerRepositories < Gitlab::Database::Migration[1.0] + INDEX_NAME = 'index_container_repositories_on_greatest_done_at' + disable_ddl_transaction! + + def up + add_concurrent_index :container_repositories, + 'GREATEST(migration_pre_import_done_at, migration_import_done_at, migration_aborted_at)', + where: "migration_state IN ('import_done', 'pre_import_done', 'import_aborted')", + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :container_repositories, INDEX_NAME + end +end diff --git a/db/schema_migrations/20220128194722 b/db/schema_migrations/20220128194722 new file mode 100644 index 00000000000..9c06f452c1e --- /dev/null +++ b/db/schema_migrations/20220128194722 @@ -0,0 +1 @@ +087338f0b438d2aa33bc22bd3973d818c5d1f40948525d95181751722158605b
\ No newline at end of file diff --git a/db/schema_migrations/20220204154220 b/db/schema_migrations/20220204154220 new file mode 100644 index 00000000000..42da4e82258 --- /dev/null +++ b/db/schema_migrations/20220204154220 @@ -0,0 +1 @@ +efecc3c6468d8a5036352f5b62e8d70de835d1beb4e45ba6d3906906d0317848
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 383f6d81c7f..501f304a706 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -26066,6 +26066,10 @@ CREATE INDEX index_composer_cache_files_where_namespace_id_is_null ON packages_c CREATE INDEX index_container_expiration_policies_on_next_run_at_and_enabled ON container_expiration_policies USING btree (next_run_at, enabled); +CREATE INDEX index_container_repositories_on_greatest_done_at ON container_repositories USING btree (GREATEST(migration_pre_import_done_at, migration_import_done_at, migration_aborted_at)) WHERE (migration_state = ANY (ARRAY['import_done'::text, 'pre_import_done'::text, 'import_aborted'::text])); + +CREATE INDEX index_container_repositories_on_migration_state_import_done_at ON container_repositories USING btree (migration_state, migration_import_done_at); + CREATE INDEX index_container_repositories_on_project_id ON container_repositories USING btree (project_id); CREATE INDEX index_container_repositories_on_project_id_and_id ON container_repositories USING btree (project_id, id); |