From 85480a7198ec50b0c32fd434c0d59feafa0a013d Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Mon, 19 Mar 2012 15:58:51 -0400 Subject: [PATCH] DB layout for recording custom toolbars Signed-off-by: Mike Rylander Signed-off-by: Jason Etheridge Signed-off-by: Thomas Berezansky --- Open-ILS/examples/fm_IDL.xml | 37 +++++++++++++++++++++++ Open-ILS/src/sql/Pg/005.schema.actors.sql | 18 +++++++++++ 2 files changed, 55 insertions(+) diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 21236c305d..28f8ee3e1b 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -1095,10 +1095,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + @@ -2777,6 +2779,41 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Open-ILS/src/sql/Pg/005.schema.actors.sql b/Open-ILS/src/sql/Pg/005.schema.actors.sql index 9c219e08d3..4fead81a7c 100644 --- a/Open-ILS/src/sql/Pg/005.schema.actors.sql +++ b/Open-ILS/src/sql/Pg/005.schema.actors.sql @@ -630,4 +630,22 @@ CREATE TABLE actor.usr_activity ( event_time TIMESTAMPTZ NOT NULL DEFAULT NOW() ); +CREATE TABLE actor.toolbar ( + id BIGSERIAL PRIMARY KEY, + ws INT REFERENCES actor.workstation (id) ON DELETE CASCADE, + org INT REFERENCES actor.org_unit (id) ON DELETE CASCADE, + usr INT REFERENCES actor.usr (id) ON DELETE CASCADE, + label TEXT NOT NULL, + layout TEXT NOT NULL, + CONSTRAINT label_once_per_ws UNIQUE (ws, label) WHERE ws IS NOT NULL, + CONSTRAINT label_once_per_org UNIQUE (org, label) WHERE org IS NOT NULL, + CONSTRAINT label_once_per_usr UNIQUE (usr, label) WHERE usr IS NOT NULL, + CONSTRAINT only_one_type CHECK ( + (ws IS NOT NULL AND COALESCE(org,usr) IS NULL) OR + (org IS NOT NULL AND COALESCE(ws,usr) IS NULL) OR + (usr IS NOT NULL AND COALESCE(org,ws) IS NULL) + ), + CONSTRAINT layout_must_be_json CHECK ( is_json(layout) ) +); + COMMIT; -- 2.43.2