diff --git a/db/migrate/20230112104253_add_tmp_index_to_ci_build_runner_session.rb b/db/migrate/20230112104253_add_tmp_index_to_ci_build_runner_session.rb new file mode 100644 index 0000000000000000000000000000000000000000..62f202c1ee2efc03105e8f3d5a8f6fa753215268 --- /dev/null +++ b/db/migrate/20230112104253_add_tmp_index_to_ci_build_runner_session.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class AddTmpIndexToCiBuildRunnerSession < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = :tmp_index_ci_builds_runner_session_on_partition_id_and_id + TABLE_NAME = :ci_builds_runner_session + + def up + return unless Gitlab.com? + + add_concurrent_index( + TABLE_NAME, + [:partition_id, :id], + where: 'partition_id = 101', + name: INDEX_NAME + ) + end + + def down + remove_concurrent_index_by_name(TABLE_NAME, INDEX_NAME) + end +end diff --git a/db/migrate/20230112104526_add_tmp_index_to_ci_pending_build.rb b/db/migrate/20230112104526_add_tmp_index_to_ci_pending_build.rb new file mode 100644 index 0000000000000000000000000000000000000000..3666e03a8b5e70b8a7130831ec6c2189ac8ab913 --- /dev/null +++ b/db/migrate/20230112104526_add_tmp_index_to_ci_pending_build.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class AddTmpIndexToCiPendingBuild < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = :tmp_index_ci_pending_builds_on_partition_id_and_id + TABLE_NAME = :ci_pending_builds + + def up + return unless Gitlab.com? + + add_concurrent_index( + TABLE_NAME, + [:partition_id, :id], + where: 'partition_id = 101', + name: INDEX_NAME + ) + end + + def down + remove_concurrent_index_by_name(TABLE_NAME, INDEX_NAME) + end +end diff --git a/db/migrate/20230112104636_add_tmp_index_to_ci_running_build.rb b/db/migrate/20230112104636_add_tmp_index_to_ci_running_build.rb new file mode 100644 index 0000000000000000000000000000000000000000..66c66cc1cd9150a3ee6c8758b28d10842969a211 --- /dev/null +++ b/db/migrate/20230112104636_add_tmp_index_to_ci_running_build.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class AddTmpIndexToCiRunningBuild < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = :tmp_index_ci_running_builds_on_partition_id_and_id + TABLE_NAME = :ci_running_builds + + def up + return unless Gitlab.com? + + add_concurrent_index( + TABLE_NAME, + [:partition_id, :id], + where: 'partition_id = 101', + name: INDEX_NAME + ) + end + + def down + remove_concurrent_index_by_name(TABLE_NAME, INDEX_NAME) + end +end diff --git a/db/schema_migrations/20230112104253 b/db/schema_migrations/20230112104253 new file mode 100644 index 0000000000000000000000000000000000000000..dd1f72374488786a833fd4fc4edae6d41b50dc70 --- /dev/null +++ b/db/schema_migrations/20230112104253 @@ -0,0 +1 @@ +e15e005b840e8d6037548d2abec3ddbae9698ce29e41ac63b134cfc57361d311 \ No newline at end of file diff --git a/db/schema_migrations/20230112104526 b/db/schema_migrations/20230112104526 new file mode 100644 index 0000000000000000000000000000000000000000..6f7dc070f72c1646e3839fe66f9d42bbbbf1a431 --- /dev/null +++ b/db/schema_migrations/20230112104526 @@ -0,0 +1 @@ +7824b001286975b284a1cc9dafd58e8959d9f9560a283b139551542bea82b128 \ No newline at end of file diff --git a/db/schema_migrations/20230112104636 b/db/schema_migrations/20230112104636 new file mode 100644 index 0000000000000000000000000000000000000000..ed9fbf67d972dd66ed6d3216e0388ebc3bbb9512 --- /dev/null +++ b/db/schema_migrations/20230112104636 @@ -0,0 +1 @@ +ec9497e49f2b1289c144abf50aeb288fdbdf9543cf87bb874054bf6bb51c645f \ No newline at end of file