# HG changeset patch # User jbe # Date 1595955440 -7200 # Node ID ae53fc96c95321a50569c024f4f6d8783b296f09 # Parent 5ae68278492fffb091b80b3d25f6e2b33f56136e Added JSONB column "attr" to table "unit" for extended attributes of any kind diff -r 5ae68278492f -r ae53fc96c953 core.sql --- a/core.sql Sun May 17 13:56:43 2020 +0200 +++ b/core.sql Tue Jul 28 18:57:20 2020 +0200 @@ -634,7 +634,8 @@ "active" BOOLEAN NOT NULL DEFAULT TRUE, "name" TEXT NOT NULL, -- full text search "description" TEXT NOT NULL DEFAULT '', -- full text search - "external_reference" TEXT, + "attr" JSONB NOT NULL DEFAULT '{}' CHECK (jsonb_typeof("attr") = 'object'), + "external_reference" TEXT, -- TODO: move external_reference to attr (also for area, issue, etc.) "member_count" INT4, "member_weight" INT4, "location" JSONB ); @@ -647,6 +648,7 @@ COMMENT ON COLUMN "unit"."parent_id" IS 'Parent id of tree node; Multiple roots allowed'; COMMENT ON COLUMN "unit"."active" IS 'TRUE means new issues can be created in areas of this unit'; +COMMENT ON COLUMN "unit"."attr" IS 'Opaque data structure to store any extended attributes used by frontend or middleware'; COMMENT ON COLUMN "unit"."external_reference" IS 'Opaque data field to store an external reference'; COMMENT ON COLUMN "unit"."member_count" IS 'Count of members as determined by column "voting_right" in table "privilege" (only active members counted)'; COMMENT ON COLUMN "unit"."member_weight" IS 'Sum of active members'' voting weight'; diff -r 5ae68278492f -r ae53fc96c953 update/core-update.v4.2.0-v4.2.1.sql --- a/update/core-update.v4.2.0-v4.2.1.sql Sun May 17 13:56:43 2020 +0200 +++ b/update/core-update.v4.2.0-v4.2.1.sql Tue Jul 28 18:57:20 2020 +0200 @@ -4,6 +4,9 @@ BEGIN; +ALTER TABLE "unit" ADD COLUMN "attr" JSONB NOT NULL DEFAULT '{}' CHECK (jsonb_typeof("attr") = 'object'); +COMMENT ON COLUMN "unit"."attr" IS 'Opaque data structure to store any extended attributes used by frontend or middleware'; + ALTER TABLE "unit" ADD COLUMN "member_weight" INT4; COMMENT ON COLUMN "unit"."member_weight" IS 'Sum of active members'' voting weight';