diff --git a/src/main/resources/db/migration/0200/V209__TerraformationContact.sql b/src/main/resources/db/migration/0200/V209__TerraformationContact.sql new file mode 100644 index 000000000000..2875df2f67c9 --- /dev/null +++ b/src/main/resources/db/migration/0200/V209__TerraformationContact.sql @@ -0,0 +1,3 @@ +CREATE UNIQUE INDEX organization_users_contact_uk +ON organization_users (organization_id) +WHERE role_id = 5; diff --git a/src/main/resources/db/migration/R__TypeCodes.sql b/src/main/resources/db/migration/R__TypeCodes.sql index d8fac7cdebd0..ff0fa6c1ea55 100644 --- a/src/main/resources/db/migration/R__TypeCodes.sql +++ b/src/main/resources/db/migration/R__TypeCodes.sql @@ -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) diff --git a/src/main/resources/i18n/Enums_en.properties b/src/main/resources/i18n/Enums_en.properties index 4037738dd1f6..41e046a4eadc 100644 --- a/src/main/resources/i18n/Enums_en.properties +++ b/src/main/resources/i18n/Enums_en.properties @@ -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 diff --git a/src/test/kotlin/com/terraformation/backend/customer/db/OrganizationStoreTest.kt b/src/test/kotlin/com/terraformation/backend/customer/db/OrganizationStoreTest.kt index a1ae6ebec87a..15532fe7c721 100644 --- a/src/test/kotlin/com/terraformation/backend/customer/db/OrganizationStoreTest.kt +++ b/src/test/kotlin/com/terraformation/backend/customer/db/OrganizationStoreTest.kt @@ -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)