Skip to content

Commit

Permalink
SW-4237 Add 'Terraformation Contact' role in database schema (#1370)
Browse files Browse the repository at this point in the history
- Also add a unique index constraint on organization user with the Terraformation Contact role id
  • Loading branch information
karthikbtf authored Sep 20, 2023
1 parent 04fe5e9 commit b36ca2d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE UNIQUE INDEX organization_users_contact_uk
ON organization_users (organization_id)
WHERE role_id = 5;
3 changes: 2 additions & 1 deletion src/main/resources/db/migration/R__TypeCodes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ INSERT INTO roles (id, name)
VALUES (1, 'Contributor'),
(2, 'Manager'),
(3, 'Admin'),
(4, 'Owner')
(4, 'Owner'),
(5, 'Terraformation Contact')
ON CONFLICT (id) DO UPDATE SET name = excluded.name;

INSERT INTO seedbank.seed_quantity_units (id, name)
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/i18n/Enums_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public.Role.Admin=Admin
public.Role.Contributor=Contributor
public.Role.Manager=Manager
public.Role.Owner=Owner
public.Role.TerraformationContact=Terraformation Contact
public.SeedStorageBehavior.Intermediate=Intermediate
public.SeedStorageBehavior.LikelyIntermediate=Likely Intermediate
public.SeedStorageBehavior.LikelyOrthodox=Likely Orthodox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ internal class OrganizationStoreTest : DatabaseTest(), RunsAsUser {
Role.Manager to 0,
Role.Contributor to 1,
Role.Owner to 2,
Role.TerraformationContact to 0,
)
val actual = store.countRoleUsers(organizationId)

Expand Down

0 comments on commit b36ca2d

Please sign in to comment.