-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(github_actions_usage): Prisma migration for db user
Moves the manually applied SQL script to create the `github_actions_usage` user, and apply permissions, to a Prisma migration, so that it gets automatically applied.
- Loading branch information
Showing
3 changed files
with
43 additions
and
11 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
packages/common/prisma/migrations/20240614143000_github_actions_usage_user/migration.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,21 @@ | ||
DO | ||
$do$ | ||
BEGIN | ||
-- Create the `github_actions_usage` user if it doesn't exist | ||
IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = 'github_actions_usage') THEN | ||
CREATE USER github_actions_usage WITH LOGIN; | ||
END IF; | ||
|
||
-- The rds_iam role is created by the RDS IAM extension, which is not available in DEV | ||
IF EXISTS (select * from pg_roles where rolname='rds_iam') THEN | ||
GRANT rds_iam TO github_actions_usage; | ||
END IF; | ||
|
||
GRANT USAGE ON SCHEMA public TO github_actions_usage; | ||
GRANT SELECT ON public.github_workflows TO github_actions_usage; | ||
GRANT SELECT ON public.github_repositories TO github_actions_usage; | ||
|
||
-- The github_actions_usage user owns this table, so can do full CRUD operations | ||
GRANT ALL ON public.guardian_github_actions_usage TO github_actions_usage; | ||
END | ||
$do$; |
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 was deleted.
Oops, something went wrong.