summaryrefslogtreecommitdiff
path: root/db/migrate/20230109095159_add_runner_machines_created_at_index.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20230109095159_add_runner_machines_created_at_index.rb')
-rw-r--r--db/migrate/20230109095159_add_runner_machines_created_at_index.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/db/migrate/20230109095159_add_runner_machines_created_at_index.rb b/db/migrate/20230109095159_add_runner_machines_created_at_index.rb
new file mode 100644
index 00000000000..e9ca4851497
--- /dev/null
+++ b/db/migrate/20230109095159_add_runner_machines_created_at_index.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddRunnerMachinesCreatedAtIndex < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_ci_runner_machines_on_created_at_and_id_desc'
+
+ def up
+ add_concurrent_index :ci_runner_machines, [:created_at, :id], order: { id: :desc }, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_runner_machines, INDEX_NAME
+ end
+end