diff --git a/db/post_migrate/20231205092529_drop_unique_index_job_id_file_type_to_ci_job_artifact.rb b/db/post_migrate/20231205092529_drop_unique_index_job_id_file_type_to_ci_job_artifact.rb new file mode 100644 index 0000000000000000000000000000000000000000..df52f76e1c45c4c6e5762d09b43e6e1c49111154 --- /dev/null +++ b/db/post_migrate/20231205092529_drop_unique_index_job_id_file_type_to_ci_job_artifact.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class DropUniqueIndexJobIdFileTypeToCiJobArtifact < Gitlab::Database::Migration[2.2] + milestone '16.7' + disable_ddl_transaction! + TABLE_NAME = :ci_job_artifacts + INDEX_NAME = :index_ci_job_artifacts_on_job_id_and_file_type + + def up + remove_concurrent_index_by_name(TABLE_NAME, INDEX_NAME) + end + + def down + add_concurrent_index(TABLE_NAME, %i[job_id file_type], unique: true, name: INDEX_NAME) + end +end diff --git a/db/schema_migrations/20231205092529 b/db/schema_migrations/20231205092529 new file mode 100644 index 0000000000000000000000000000000000000000..adc729e9f7a461a9cf0f82084951cd15392e22e9 --- /dev/null +++ b/db/schema_migrations/20231205092529 @@ -0,0 +1 @@ +5ca9bd14a7c69b4b77745303c47c7d11890f3ced97c8a1a68b5b713b29a2dab7 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 551de511fafbca3f6775dbabe10c5abfb1b55b5c..b8b0f57a22e8ef052c2397ba57be8b471b3fa3db 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -32155,8 +32155,6 @@ CREATE INDEX index_ci_job_artifacts_on_id_project_id_and_created_at ON ci_job_ar CREATE INDEX index_ci_job_artifacts_on_id_project_id_and_file_type ON ci_job_artifacts USING btree (project_id, file_type, id); -CREATE UNIQUE INDEX index_ci_job_artifacts_on_job_id_and_file_type ON ci_job_artifacts USING btree (job_id, file_type); - CREATE INDEX index_ci_job_artifacts_on_partition_id_job_id ON ci_job_artifacts USING btree (partition_id, job_id); CREATE INDEX index_ci_job_artifacts_on_project_id ON ci_job_artifacts USING btree (project_id);