Commit c7b8f117 authored by Steve Abrams's avatar Steve Abrams

Merge branch '207385-services-unique-constraint-on-type' into 'master'

Add unique index on services project_id and type

See merge request gitlab-org/gitlab!52563
parents 696855d8 7782b276
---
title: Add unique index on services project_id and type
merge_request: 52563
author:
type: changed
# 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
# frozen_string_literal: true
class RemoveIndexServicesProjectIdAndType < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
INDEX_NAME = 'index_services_on_project_id_and_type'
# Replaced by the index added in 20210126091713_add_unique_index_services_project_id_and_type.rb
def up
remove_concurrent_index_by_name :services, name: INDEX_NAME
end
def down
add_concurrent_index :services, [:project_id, :type], name: INDEX_NAME
end
end
3906739d07514e6e59f79a4a81d28859a2481614a299c95ec1b1d9825a07ec64
\ No newline at end of file
124c5ae1a1ccade5dec01f72b726e03febc8f56411d7d8990f976bb2a9516037
\ No newline at end of file
......@@ -23003,7 +23003,7 @@ CREATE INDEX index_service_desk_enabled_projects_on_id_creator_id_created_at ON
CREATE INDEX index_services_on_inherit_from_id ON services USING btree (inherit_from_id);
CREATE INDEX index_services_on_project_id_and_type ON services USING btree (project_id, type);
CREATE UNIQUE INDEX index_services_on_project_id_and_type_unique ON services USING btree (project_id, type);
CREATE INDEX index_services_on_template ON services USING btree (template);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment