Skip to content

Commit

Permalink
avniproject/avni-etl#112 |Reference commands to fix openchs user on l…
Browse files Browse the repository at this point in the history
…ocal db when it fails to perform create_db_user() action
  • Loading branch information
himeshr committed Nov 21, 2024
1 parent 14a7540 commit 3077ddf
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions avni-server-api/src/main/resources/database/usefulQueries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,21 @@ pg_dump --dbname=openchs --username=openchs --role=<org_role> --file=/Users/test
psql -U openchs --host=localhost --port=6015 -d openchs -f /Users/test/target-dump-update.sql

-- to drop roles. check the oid value
select 'drop role "' || a.rolname || '";' FROM pg_roles a
WHERE pg_has_role('openchs', a.oid, 'member') AND a.rolname <> 'openchs' and a.oid > 1443729
select 'drop role "' || a.rolname || '";'
FROM pg_roles a
WHERE pg_has_role('openchs', a.oid, 'member')
AND a.rolname <> 'openchs'
and a.oid > 1443729
order by a.oid;


-- START // To gain admin role option for openchs user, useful when newly creating openchs / avni_org DB
CREATE ROLE openchs;

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO openchs;

GRANT ALL PRIVILEGES ON DATABASE "postgres" to openchs;

ALTER USER openchs WITH SUPERUSER;

-- END // To gain admin role option for openchs user, useful when newly creating openchs / avni_org DB

0 comments on commit 3077ddf

Please sign in to comment.