diff options
Diffstat (limited to 'db/migrate/20210126091713_add_unique_index_services_project_id_and_type.rb')
-rw-r--r-- | db/migrate/20210126091713_add_unique_index_services_project_id_and_type.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20210126091713_add_unique_index_services_project_id_and_type.rb b/db/migrate/20210126091713_add_unique_index_services_project_id_and_type.rb new file mode 100644 index 00000000000..272dca70a8b --- /dev/null +++ b/db/migrate/20210126091713_add_unique_index_services_project_id_and_type.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddUniqueIndexServicesProjectIdAndType < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + INDEX_NAME = 'index_services_on_project_id_and_type_unique' + + def up + add_concurrent_index :services, [:project_id, :type], name: INDEX_NAME, unique: true + end + + def down + remove_concurrent_index_by_name :services, name: INDEX_NAME + end +end |