-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: init public beta org and svcfmtm user migration (#1206)
* build: remove odk vars from frontend build dev compose * build: remove user password field from init schema * build: fix only continue migration if sql script succeeds * build: update migration entrypoint envsubst + error handling * build: migration to create fmtm public beta org + svcfmtm * build: add gettext for envsubst command in dockerfile * build: use odk user email for svcfmtm user email * fix: replace org init with startup code for pass encrypt * fix: specify user id for svcfmtm admin init * build: fix remove sequential user id (create manually) * build: remove default user creation from migration script * build: fix project-roles migration if enum exists
- Loading branch information
1 parent
3632bd4
commit 76ebcc9
Showing
9 changed files
with
116 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
-- ## Migration to: | ||
-- * Add public.projectrol enum. | ||
-- * Add public.projectrole enum. | ||
-- * Update the user_roles table to use the enum | ||
|
||
-- Start a transaction | ||
BEGIN; | ||
|
||
CREATE TYPE public.projectrole as ENUM ( | ||
-- Create projectrole enum if it doesn't exist | ||
DO $$ | ||
BEGIN | ||
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'projectrole') THEN | ||
CREATE TYPE public.projectrole AS ENUM ( | ||
'MAPPER', | ||
'VALIDATOR', | ||
'FIELD_MANAGER', | ||
'ASSOCIATE_PROJECT_MANAGER', | ||
'PROJECT_MANAGER' | ||
); | ||
); | ||
END IF; | ||
END $$; | ||
ALTER TYPE public.projectrole OWNER TO fmtm; | ||
|
||
ALTER TABLE public.user_roles ALTER COLUMN "role" TYPE VARCHAR(24); | ||
ALTER TABLE public.user_roles ALTER COLUMN "role" TYPE public.projectrole USING role::public.projectrole; | ||
ALTER TYPE public.projectrole OWNER TO fmtm; | ||
|
||
-- Commit the transaction | ||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters