Commits

Anonymous committed 1d4c2f9

Fixed unique constraints in table "delegation"; Update script to v1.2.8

Comments (0)

Files changed (2)

 BEGIN;
 
 CREATE VIEW "liquid_feedback_version" AS
-  SELECT * FROM (VALUES ('1.2.7', 1, 2, 7))
+  SELECT * FROM (VALUES ('1.2.8', 1, 2, 8))
   AS "subquery"("string", "major", "minor", "revision");
 
 
           ("scope" = 'global' AND "area_id" ISNULL  AND "issue_id" ISNULL ) OR
           ("scope" = 'area'   AND "area_id" NOTNULL AND "issue_id" ISNULL ) OR
           ("scope" = 'issue'  AND "area_id" ISNULL  AND "issue_id" NOTNULL) ),
-        UNIQUE ("area_id", "truster_id", "trustee_id"),
-        UNIQUE ("issue_id", "truster_id", "trustee_id") );
+        UNIQUE ("area_id", "truster_id"),
+        UNIQUE ("issue_id", "truster_id") );
 CREATE UNIQUE INDEX "delegation_global_truster_id_trustee_id_unique_idx"
-  ON "delegation" ("truster_id", "trustee_id") WHERE "scope" = 'global';
+  ON "delegation" ("truster_id") WHERE "scope" = 'global';
 CREATE INDEX "delegation_truster_id_idx" ON "delegation" ("truster_id");
 CREATE INDEX "delegation_trustee_id_idx" ON "delegation" ("trustee_id");
 

update/core-update.v1.2.7-v1.2.8.sql

+BEGIN;
+ 
+CREATE OR REPLACE VIEW "liquid_feedback_version" AS
+  SELECT * FROM (VALUES ('1.2.8', 1, 2, 8))
+  AS "subquery"("string", "major", "minor", "revision");
+
+ALTER TABLE "delegation" DROP CONSTRAINT "delegation_area_id_key";
+ALTER TABLE "delegation" DROP CONSTRAINT "delegation_issue_id_key";
+DROP INDEX "delegation_global_truster_id_trustee_id_unique_idx";
+
+ALTER TABLE "delegation" ADD UNIQUE ("area_id", "truster_id");
+ALTER TABLE "delegation" ADD UNIQUE ("issue_id", "truster_id");
+CREATE UNIQUE INDEX "delegation_global_truster_id_trustee_id_unique_idx"
+  ON "delegation" ("truster_id") WHERE "scope" = 'global';
+
+COMMIT;