# HG changeset patch # User jbe # Date 1606488331 -3600 # Node ID 5b3b20f1278d5418ec2ea4b8493327341a1975ea # Parent 8e9d0878b5dcdfba0051a93c33746f6e2297e0a0 Added missing referential integrity constraint on "posting" table diff -r 8e9d0878b5dc -r 5b3b20f1278d core.sql --- a/core.sql Mon Oct 05 16:18:17 2020 +0200 +++ b/core.sql Fri Nov 27 15:45:31 2020 +0100 @@ -1386,6 +1386,7 @@ FOREIGN KEY ("area_id", "issue_id") REFERENCES "issue" ("area_id", "id") ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY ("policy_id", "issue_id") REFERENCES "issue" ("policy_id", "id") ON DELETE CASCADE ON UPDATE CASCADE, "initiative_id" INT4, + FOREIGN KEY ("issue_id", "initiative_id") REFERENCES "initiative" ("issue_id", "id"), "suggestion_id" INT8, -- NOTE: no referential integrity for suggestions because those are -- actually deleted diff -r 8e9d0878b5dc -r 5b3b20f1278d update/core-update.v4.2.0-v4.2.1.sql --- a/update/core-update.v4.2.0-v4.2.1.sql Mon Oct 05 16:18:17 2020 +0200 +++ b/update/core-update.v4.2.0-v4.2.1.sql Fri Nov 27 15:45:31 2020 +0100 @@ -47,6 +47,8 @@ COMMENT ON COLUMN "delegating_voter"."ownweight" IS 'Own voting weight of member, disregarding delegations'; COMMENT ON COLUMN "delegating_voter"."weight" IS 'Intermediate voting weight considering incoming delegations'; +ALTER TABLE "posting" ADD FOREIGN KEY ("issue_id", "initiative_id") REFERENCES "initiative" ("issue_id", "id"); + DROP VIEW "issue_delegation"; CREATE VIEW "issue_delegation" AS SELECT DISTINCT ON ("issue"."id", "delegation"."truster_id")