diff --git a/dal/schema/000028_init.down.sql b/dal/schema/000028_init.down.sql index fc104d9..5cde0bd 100644 --- a/dal/schema/000028_init.down.sql +++ b/dal/schema/000028_init.down.sql @@ -6,4 +6,5 @@ DROP TABLE If EXIST YclientsServices; DROP TABLE If EXIST YclientsTimeSlots; DROP TABLE If EXIST YclientsRules; -DROP INDEX if exist idx_unique_tokens_yclients; \ No newline at end of file +DROP INDEX if exist idx_unique_tokens_yclients; +DROP INDEX if exist idx_unique_yclients_rules; \ No newline at end of file diff --git a/dal/schema/000028_init.up.sql b/dal/schema/000028_init.up.sql index d3025b2..a95ff20 100644 --- a/dal/schema/000028_init.up.sql +++ b/dal/schema/000028_init.up.sql @@ -86,6 +86,8 @@ CREATE TABLE IF NOT EXISTS YclientsRules ( CreatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ); +CREATE UNIQUE INDEX idx_unique_yclients_rules ON YclientsRules (SalonID, QuizID) WHERE Deleted = false; + DO $$ BEGIN IF NOT EXISTS (