LP1830391 Workstation settings unique constraint
authorBill Erickson <berickxx@gmail.com>
Thu, 23 May 2019 22:02:41 +0000 (18:02 -0400)
committerJason Boyer <JBoyer@eoli.info>
Fri, 13 Dec 2019 14:36:29 +0000 (09:36 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jason Boyer <JBoyer@eoli.info>
Open-ILS/src/sql/Pg/005.schema.actors.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.hatch-enable-print.sql

index 0572543..33ae628 100644 (file)
@@ -1108,7 +1108,8 @@ CREATE TABLE actor.workstation_setting (
                        ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
     name        TEXT   NOT NULL REFERENCES config.workstation_setting_type (name) 
                        ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,
-    value       JSON   NOT NULL
+    value       JSON   NOT NULL,
+    CONSTRAINT  ws_once_per_key UNIQUE (workstation, name)
 );
 
 CREATE INDEX actor_workstation_setting_workstation_idx 
index 315c85b..e9e8b0e 100644 (file)
@@ -12,6 +12,8 @@ VALUES (
     )
 );
 
+ALTER TABLE actor.workstation_setting
+    ADD CONSTRAINT ws_once_per_key UNIQUE (workstation, name);
 
 COMMIT;