Skip to content

Commit

Permalink
feat: remove back-ref for creators, ensure tests for adding creators …
Browse files Browse the repository at this point in the history
…groups (#440)
  • Loading branch information
golanglemonade authored Feb 5, 2025
1 parent e19919f commit f4529dc
Show file tree
Hide file tree
Showing 38 changed files with 3,578 additions and 11,079 deletions.
7 changes: 7 additions & 0 deletions db/migrations-goose-postgres/20250204210422_creator_edge.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- +goose Up
-- modify "groups" table
ALTER TABLE "groups" ADD COLUMN "organization_control_creators" character varying NULL, ADD COLUMN "organization_control_objective_creators" character varying NULL, ADD COLUMN "organization_group_creators" character varying NULL, ADD COLUMN "organization_internal_policy_creators" character varying NULL, ADD COLUMN "organization_narrative_creators" character varying NULL, ADD COLUMN "organization_procedure_creators" character varying NULL, ADD COLUMN "organization_program_creators" character varying NULL, ADD COLUMN "organization_risk_creators" character varying NULL, ADD COLUMN "organization_template_creators" character varying NULL, ADD CONSTRAINT "groups_organizations_control_creators" FOREIGN KEY ("organization_control_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, ADD CONSTRAINT "groups_organizations_control_objective_creators" FOREIGN KEY ("organization_control_objective_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, ADD CONSTRAINT "groups_organizations_group_creators" FOREIGN KEY ("organization_group_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, ADD CONSTRAINT "groups_organizations_internal_policy_creators" FOREIGN KEY ("organization_internal_policy_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, ADD CONSTRAINT "groups_organizations_narrative_creators" FOREIGN KEY ("organization_narrative_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, ADD CONSTRAINT "groups_organizations_procedure_creators" FOREIGN KEY ("organization_procedure_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, ADD CONSTRAINT "groups_organizations_program_creators" FOREIGN KEY ("organization_program_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, ADD CONSTRAINT "groups_organizations_risk_creators" FOREIGN KEY ("organization_risk_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, ADD CONSTRAINT "groups_organizations_template_creators" FOREIGN KEY ("organization_template_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL;

-- +goose Down
-- reverse: modify "groups" table
ALTER TABLE "groups" DROP CONSTRAINT "groups_organizations_template_creators", DROP CONSTRAINT "groups_organizations_risk_creators", DROP CONSTRAINT "groups_organizations_program_creators", DROP CONSTRAINT "groups_organizations_procedure_creators", DROP CONSTRAINT "groups_organizations_narrative_creators", DROP CONSTRAINT "groups_organizations_internal_policy_creators", DROP CONSTRAINT "groups_organizations_group_creators", DROP CONSTRAINT "groups_organizations_control_objective_creators", DROP CONSTRAINT "groups_organizations_control_creators", DROP COLUMN "organization_template_creators", DROP COLUMN "organization_risk_creators", DROP COLUMN "organization_program_creators", DROP COLUMN "organization_procedure_creators", DROP COLUMN "organization_narrative_creators", DROP COLUMN "organization_internal_policy_creators", DROP COLUMN "organization_group_creators", DROP COLUMN "organization_control_objective_creators", DROP COLUMN "organization_control_creators";
3 changes: 2 additions & 1 deletion db/migrations-goose-postgres/atlas.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
h1:jm0SwIHuYS3rvLKWiGMHgHAPJQKvnhwchD3LHpdjbHQ=
h1:XUQ3queUoY2lTFbO7RW9R6W5Bs83Pfmtz6whKYlH2pc=
20241211231032_init.sql h1:Cj6GduEDECy6Y+8DfI6767WosqG2AKWybIyJJ6AgKqA=
20241212223714_consistent_naming.sql h1:RvnNmsStlHkmAdSCnX1fFh/KYgfj1RMYYEc4iCN9JcQ=
20250109002850_billing_address.sql h1:m0ek3WXqRgS3+ZbSa/DcIMB16vb8Tjm2MgNqyRll3rU=
Expand All @@ -13,3 +13,4 @@ h1:jm0SwIHuYS3rvLKWiGMHgHAPJQKvnhwchD3LHpdjbHQ=
20250127184838_evidence.sql h1:iZOb/fQyaxMbyxBwZRIkLo1th20lE7KIHO5JNiCHVBc=
20250131173616_group_settings.sql h1:MNai35YgUHynkckgxKdixAXmTFqJaV5F2c8EHbLRhms=
20250204175356_unique_name_citext.sql h1:Y4qnDbQfyQcUrUtKUV4kTWgsnlHWYr7K6dOi/UCD/yQ=
20250204210422_creator_edge.sql h1:YxEKPaYFg3mKK+oguWVrtykUaicN0vMlTGd3+2FFW70=
2 changes: 2 additions & 0 deletions db/migrations/20250204210420_creator_edge.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Modify "groups" table
ALTER TABLE "groups" ADD COLUMN "organization_control_creators" character varying NULL, ADD COLUMN "organization_control_objective_creators" character varying NULL, ADD COLUMN "organization_group_creators" character varying NULL, ADD COLUMN "organization_internal_policy_creators" character varying NULL, ADD COLUMN "organization_narrative_creators" character varying NULL, ADD COLUMN "organization_procedure_creators" character varying NULL, ADD COLUMN "organization_program_creators" character varying NULL, ADD COLUMN "organization_risk_creators" character varying NULL, ADD COLUMN "organization_template_creators" character varying NULL, ADD CONSTRAINT "groups_organizations_control_creators" FOREIGN KEY ("organization_control_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, ADD CONSTRAINT "groups_organizations_control_objective_creators" FOREIGN KEY ("organization_control_objective_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, ADD CONSTRAINT "groups_organizations_group_creators" FOREIGN KEY ("organization_group_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, ADD CONSTRAINT "groups_organizations_internal_policy_creators" FOREIGN KEY ("organization_internal_policy_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, ADD CONSTRAINT "groups_organizations_narrative_creators" FOREIGN KEY ("organization_narrative_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, ADD CONSTRAINT "groups_organizations_procedure_creators" FOREIGN KEY ("organization_procedure_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, ADD CONSTRAINT "groups_organizations_program_creators" FOREIGN KEY ("organization_program_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, ADD CONSTRAINT "groups_organizations_risk_creators" FOREIGN KEY ("organization_risk_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, ADD CONSTRAINT "groups_organizations_template_creators" FOREIGN KEY ("organization_template_creators") REFERENCES "organizations" ("id") ON UPDATE NO ACTION ON DELETE SET NULL;
3 changes: 2 additions & 1 deletion db/migrations/atlas.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
h1:R+rwupgcr4cPpwhHTxeQI1QPIcLQlOEg3VXssf1Qr5g=
h1:jkPhvAtsJ2BchTUSARDWa5gOSen2CCQEIO3ymL6P+L4=
20241211231032_init.sql h1:TxjpHzKPB/5L2i7V2JfO1y+Cep/AyQN5wGjhY7saCeE=
20241212223712_consistent_naming.sql h1:tbdYOtixhW66Jmvy3aCm+X6neI/SRVvItKM0Bdn26TA=
20250109002849_billing_address.sql h1:mspCGbJ6HVmx3r4j+d/WvruzirJdJ8u5x18WF9R9ESE=
Expand All @@ -13,3 +13,4 @@ h1:R+rwupgcr4cPpwhHTxeQI1QPIcLQlOEg3VXssf1Qr5g=
20250127184836_evidence.sql h1:DEV/KXv9L9IW3uXwmQiKvutuAg9HyaoIP3eSyadtKec=
20250131173614_group_settings.sql h1:NPt5pCa9zCVDHHmyyuWm5Edl0VRX+UToyEVnPsaPcek=
20250204175354_unique_name_citext.sql h1:1+4ZoEzHkr8VNdg2H5XDbzGLNvptx2+3aU5DS73dhR4=
20250204210420_creator_edge.sql h1:IpzaUbCWcMqaDEkXkpacuzYciHmMXCJx3HYUDzOP82c=
Loading

0 comments on commit f4529dc

Please sign in to comment.