Commit dda57adf authored by Steve Abrams's avatar Steve Abrams

Merge branch '353552-fix-work-item-type-null-namespaces' into 'master'

Add unique index for work item type names with no namespace

See merge request gitlab-org/gitlab!84787
parents 5b01e1f8 7b5d932c
# frozen_string_literal: true
class AddWorkItemTypeNameUniqueIndexNullNamespaces < Gitlab::Database::Migration[1.0]
INDEX_NAME = :idx_work_item_types_on_namespace_id_and_name_null_namespace
disable_ddl_transaction!
def up
add_concurrent_index :work_item_types,
'TRIM(BOTH FROM LOWER(name)), (namespace_id IS NULL)',
unique: true,
name: INDEX_NAME,
where: 'namespace_id IS NULL'
end
def down
remove_concurrent_index_by_name :work_item_types, INDEX_NAME
end
end
42d7864cdcec589b7de8bc3a872e2743496d81788a60ddcd213f049fda12474e
\ No newline at end of file
......@@ -26645,6 +26645,8 @@ CREATE UNIQUE INDEX idx_vulnerability_issue_links_on_vulnerability_id_and_issue_
CREATE UNIQUE INDEX idx_vulnerability_issue_links_on_vulnerability_id_and_link_type ON vulnerability_issue_links USING btree (vulnerability_id, link_type) WHERE (link_type = 2);
CREATE UNIQUE INDEX idx_work_item_types_on_namespace_id_and_name_null_namespace ON work_item_types USING btree (btrim(lower(name)), ((namespace_id IS NULL))) WHERE (namespace_id IS NULL);
CREATE INDEX index_abuse_reports_on_user_id ON abuse_reports USING btree (user_id);
CREATE INDEX index_agent_activity_events_on_agent_id_and_recorded_at_and_id ON agent_activity_events USING btree (agent_id, recorded_at, id);
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