diff options
Diffstat (limited to 'db/post_migrate/20220802132158_index_on_integration_type_new_id_when_active_and_has_group.rb')
-rw-r--r-- | db/post_migrate/20220802132158_index_on_integration_type_new_id_when_active_and_has_group.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/db/post_migrate/20220802132158_index_on_integration_type_new_id_when_active_and_has_group.rb b/db/post_migrate/20220802132158_index_on_integration_type_new_id_when_active_and_has_group.rb new file mode 100644 index 00000000000..81e95f531c1 --- /dev/null +++ b/db/post_migrate/20220802132158_index_on_integration_type_new_id_when_active_and_has_group.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class IndexOnIntegrationTypeNewIdWhenActiveAndHasGroup < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'index_integrations_on_type_new_id_when_active_and_has_group' + + disable_ddl_transaction! + + def up + add_concurrent_index :integrations, + [:type_new, :id, :inherit_from_id], + name: INDEX_NAME, + where: '((active = true) AND (group_id IS NOT NULL))' + end + + def down + remove_concurrent_index_by_name :integrations, INDEX_NAME + end +end |