-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migration to build out roles in db + one rename of auth guard
- Loading branch information
1 parent
be24b11
commit 473ba16
Showing
2 changed files
with
16 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- Step 1: Drop the existing check constraint if it exists | ||
ALTER TABLE "public"."user" DROP CONSTRAINT IF EXISTS user_role_check; | ||
|
||
-- Step 3: Update existing roles | ||
UPDATE "public"."user" SET role = 'case_manager' WHERE role = 'admin'; | ||
UPDATE "public"."user" SET role = 'para' WHERE role = 'staff'; | ||
|
||
-- Step 2: Add the new check constraint with the updated roles | ||
ALTER TABLE "public"."user" ADD CONSTRAINT user_role_check | ||
CHECK (role = ANY (ARRAY['user'::text, 'para'::text, 'case_manager'::text, 'admin'::text])); | ||
|
||
|
||
-- Step 4: Add a comment to the table explaining the role values | ||
COMMENT ON COLUMN "public"."user".role IS 'User role: user, para, case_manager, or admin'; |
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