diff options
Diffstat (limited to 'db/migrate/20240110092610_add_index_on_project_id_to_web_hooks.rb')
-rw-r--r-- | db/migrate/20240110092610_add_index_on_project_id_to_web_hooks.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20240110092610_add_index_on_project_id_to_web_hooks.rb b/db/migrate/20240110092610_add_index_on_project_id_to_web_hooks.rb new file mode 100644 index 00000000000..95c64caa1ce --- /dev/null +++ b/db/migrate/20240110092610_add_index_on_project_id_to_web_hooks.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddIndexOnProjectIdToWebHooks < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + + milestone '16.9' + + TABLE_NAME = :web_hooks + INDEX_NAME = 'index_web_hooks_on_project_id_and_id' + CLAUSE = "((type)::text = 'ProjectHook'::text)" + + def up + add_concurrent_index TABLE_NAME, [:project_id, :id], name: INDEX_NAME, where: CLAUSE + end + + def down + remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME + end +end |