diff --git a/db/post_migrate/20240611103909_remove_tmp_index_project_statistics_updated_at_sync.rb b/db/post_migrate/20240611103909_remove_tmp_index_project_statistics_updated_at_sync.rb new file mode 100644 index 0000000000000000000000000000000000000000..2f24949502d5f884005fb7a50a9347efcee62c29 --- /dev/null +++ b/db/post_migrate/20240611103909_remove_tmp_index_project_statistics_updated_at_sync.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class RemoveTmpIndexProjectStatisticsUpdatedAtSync < Gitlab::Database::Migration[2.2] + milestone '17.2' + disable_ddl_transaction! + + INDEX_NAME = 'tmp_index_project_statistics_updated_at' + COLUMNS = %i[project_id updated_at] + + def up + remove_concurrent_index_by_name :project_statistics, name: INDEX_NAME + end + + def down + add_concurrent_index :project_statistics, COLUMNS, name: INDEX_NAME, where: 'repository_size > 0' + end +end diff --git a/db/schema_migrations/20240611103909 b/db/schema_migrations/20240611103909 new file mode 100644 index 0000000000000000000000000000000000000000..32369f4f1e5a7e1f533e70805a645865a4e96012 --- /dev/null +++ b/db/schema_migrations/20240611103909 @@ -0,0 +1 @@ +709ac3c6cb4f879617c308cdfd91a847a95e69baefc3d68bcabb7645517689c8 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 2b6919a84bc185a5003884eb21cb19ba86e1ba90..f7a6a01befcf1f03c201fc7d2734a6b8183bf33e 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -29412,8 +29412,6 @@ CREATE INDEX tmp_index_on_vulnerabilities_non_dismissed ON vulnerabilities USING CREATE INDEX tmp_index_project_statistics_cont_registry_size ON project_statistics USING btree (project_id) WHERE (container_registry_size = 0); -CREATE INDEX tmp_index_project_statistics_updated_at ON project_statistics USING btree (project_id, updated_at) WHERE (repository_size > 0); - CREATE INDEX tmp_index_vulnerability_dismissal_info ON vulnerabilities USING btree (id) WHERE ((state = 2) AND ((dismissed_at IS NULL) OR (dismissed_by_id IS NULL))); CREATE INDEX tmp_index_vulnerability_occurrences_id_and_initial_pipline_id ON vulnerability_occurrences USING btree (id, initial_pipeline_id) WHERE (initial_pipeline_id IS NULL);