mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 00:27:31 +00:00
fix(postgres <=15): delete unique constraints (#6971)
fix(postgres): delete unique constraints
(cherry picked from commit 8982e1aae3
)
This commit is contained in:

committed by
Livio Spring

parent
f9859b0480
commit
a2fa396ec0
@@ -0,0 +1,13 @@
|
||||
-- the query is so complex because we accidentally stored unique constraint case sensitive
|
||||
-- the query checks first if there is a case sensitive match and afterwards if there is a case insensitive match
|
||||
(instance_id = $%[1]d AND unique_type = $%[2]d AND unique_field = (
|
||||
SELECT unique_field from (
|
||||
SELECT instance_id, unique_type, unique_field
|
||||
FROM eventstore.unique_constraints
|
||||
WHERE instance_id = $%[1]d AND unique_type = $%[2]d AND unique_field = $%[3]d
|
||||
UNION ALL
|
||||
SELECT instance_id, unique_type, unique_field
|
||||
FROM eventstore.unique_constraints
|
||||
WHERE instance_id = $%[1]d AND unique_type = $%[2]d AND unique_field = LOWER($%[3]d)
|
||||
) AS case_insensitive_constraints LIMIT 1)
|
||||
)
|
Reference in New Issue
Block a user