diff options
Diffstat (limited to 'db/migrate/20221102150737_index_environments_for_name_search_within_folder.rb')
-rw-r--r-- | db/migrate/20221102150737_index_environments_for_name_search_within_folder.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/db/migrate/20221102150737_index_environments_for_name_search_within_folder.rb b/db/migrate/20221102150737_index_environments_for_name_search_within_folder.rb new file mode 100644 index 00000000000..10fd8b33c45 --- /dev/null +++ b/db/migrate/20221102150737_index_environments_for_name_search_within_folder.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class IndexEnvironmentsForNameSearchWithinFolder < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_environments_for_name_search_within_folder' + + def up + add_concurrent_index :environments, + "project_id, lower(ltrim(name, environment_type || '/')) varchar_pattern_ops, state", name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :environments, INDEX_NAME + end +end |