From 1d2fbaa688059edae3bf0da8ad928cd9a2ab67e4 Mon Sep 17 00:00:00 2001 From: kanoi Date: Sat, 8 Nov 2014 16:28:45 +1100 Subject: [PATCH] sql - ... and include the db change file for 0.9.4 --- sql/v0.9.3-v0.9.4.sql | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 sql/v0.9.3-v0.9.4.sql diff --git a/sql/v0.9.3-v0.9.4.sql b/sql/v0.9.3-v0.9.4.sql new file mode 100644 index 00000000..ca8b3194 --- /dev/null +++ b/sql/v0.9.3-v0.9.4.sql @@ -0,0 +1,27 @@ +SET SESSION AUTHORIZATION 'postgres'; + +BEGIN transaction; + +DO $$ +DECLARE ver TEXT; +BEGIN + + UPDATE version set version='0.9.4' where vlock=1 and version='0.9.3'; + + IF found THEN + RETURN; + END IF; + + SELECT version into ver from version + WHERE vlock=1; + + RAISE EXCEPTION 'Wrong DB version - expect "0.9.3" - found "%"', ver; + +END $$; + +ALTER TABLE sharesummary DROP CONSTRAINT sharesummary_pkey; + +ALTER TABLE sharesummary ADD CONSTRAINT sharesummary_pkey + PRIMARY KEY (workinfoid, userid, workername); + +END transaction;