diff options
Diffstat (limited to 'db/post_migrate/20231024015915_drop_index_namespaces_on_created_at_for_gitlab_com.rb')
-rw-r--r-- | db/post_migrate/20231024015915_drop_index_namespaces_on_created_at_for_gitlab_com.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/db/post_migrate/20231024015915_drop_index_namespaces_on_created_at_for_gitlab_com.rb b/db/post_migrate/20231024015915_drop_index_namespaces_on_created_at_for_gitlab_com.rb new file mode 100644 index 00000000000..8f2f8a4064c --- /dev/null +++ b/db/post_migrate/20231024015915_drop_index_namespaces_on_created_at_for_gitlab_com.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class DropIndexNamespacesOnCreatedAtForGitlabCom < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + TABLE_NAME = :namespaces + INDEX_NAME = :index_namespaces_on_created_at + + def up + return unless should_run? + + remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME + end + + def down + return unless should_run? + + add_concurrent_index TABLE_NAME, :created_at, name: INDEX_NAME + end + + def should_run? + Gitlab.com_except_jh? + end +end |