-
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.
add steps to transfer schema table ownership
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 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,21 @@ | ||
-- Steps to transfer ownership of tables | ||
|
||
-- 1, as amichel | ||
SELECT administration.create_proxy_account('ats_replication',''); | ||
GRANT usage, create ON schema ats_replication TO ats_replication; | ||
|
||
-- 2, as <app>_replication user | ||
GRANT ats_replication TO ods_admin_user; | ||
|
||
-- 3, as ods_admin_user | ||
DO $$DECLARE | ||
table_name TEXT; | ||
BEGIN | ||
FOR table_name IN | ||
SELECT tablename | ||
FROM pg_tables | ||
WHERE schemaname = 'ats_replication' | ||
LOOP | ||
EXECUTE 'ALTER TABLE ats_replication.' || quote_ident(table_name) || ' OWNER TO ats_replication'; | ||
END LOOP; | ||
END$$; |