-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(user_roles): migrations for backfilling user_roles entity_id (#6837)
- Loading branch information
1 parent
ed276ec
commit 986de77
Showing
4 changed files
with
14 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
migrations/2024-12-02-110129_update-user-role-entity-type/down.sql
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,2 +1,2 @@ | ||
-- This file should undo anything in `up.sql` | ||
SELECT 1; | ||
UPDATE user_roles SET entity_type = NULL WHERE version = 'v1'; |
1 change: 1 addition & 0 deletions
1
migrations/2024-12-02-110129_update-user-role-entity-type/up.sql
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
2 changes: 2 additions & 0 deletions
2
migrations/2024-12-13-080558_entity-id-backfill-for-user-roles/down.sql
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,2 @@ | ||
-- This file should undo anything in `up.sql` | ||
UPDATE user_roles SET entity_id = NULL WHERE version = 'v1'; |
10 changes: 10 additions & 0 deletions
10
migrations/2024-12-13-080558_entity-id-backfill-for-user-roles/up.sql
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,10 @@ | ||
-- Your SQL goes here | ||
UPDATE user_roles | ||
SET | ||
entity_id = CASE | ||
WHEN role_id = 'org_admin' THEN org_id | ||
ELSE merchant_id | ||
END | ||
WHERE | ||
version = 'v1' | ||
AND entity_id IS NULL; |