From 836f08493fd33fbd98f270598aeb75a8c5d4a011 Mon Sep 17 00:00:00 2001 From: Chris Llanwarne Date: Thu, 21 Sep 2023 17:55:43 -0400 Subject: [PATCH] Only update metadata table ownership --- .../src/main/resources/changelog.xml | 6 ---- .../resources/changesets/set_table_role.xml | 26 -------------- .../metadata_changesets/set_table_role.xml | 35 ++++++++++++++++++- .../main/resources/sql_metadata_changelog.xml | 4 ++- 4 files changed, 37 insertions(+), 34 deletions(-) delete mode 100644 database/migration/src/main/resources/changesets/set_table_role.xml mode change 120000 => 100644 database/migration/src/main/resources/metadata_changesets/set_table_role.xml diff --git a/database/migration/src/main/resources/changelog.xml b/database/migration/src/main/resources/changelog.xml index 09c613bd24b..4419417a562 100644 --- a/database/migration/src/main/resources/changelog.xml +++ b/database/migration/src/main/resources/changelog.xml @@ -93,12 +93,6 @@ - - - - - - - - - - - - SELECT count(1) - FROM pg_roles - where '${sharedCromwellDbRole}' != '' and pg_roles.rolname = '${sharedCromwellDbRole}'; - - - REASSIGN OWNED BY CURRENT_USER TO ${sharedCromwellDbRole}; - - - diff --git a/database/migration/src/main/resources/metadata_changesets/set_table_role.xml b/database/migration/src/main/resources/metadata_changesets/set_table_role.xml deleted file mode 120000 index 8437e311cb2..00000000000 --- a/database/migration/src/main/resources/metadata_changesets/set_table_role.xml +++ /dev/null @@ -1 +0,0 @@ -../changesets/set_table_role.xml \ No newline at end of file diff --git a/database/migration/src/main/resources/metadata_changesets/set_table_role.xml b/database/migration/src/main/resources/metadata_changesets/set_table_role.xml new file mode 100644 index 00000000000..a0c4096765f --- /dev/null +++ b/database/migration/src/main/resources/metadata_changesets/set_table_role.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + SELECT count(1) + FROM pg_roles + where '${sharedCromwellDbRole}' != '' and pg_roles.rolname = '${sharedCromwellDbRole}'; + + + + ALTER TABLE "CUSTOM_LABEL_ENTRY" OWNER TO '${sharedCromwellDbRole}'; + ALTER TABLE "METADATA_ENTRY" OWNER TO '${sharedCromwellDbRole}'; + ALTER TABLE "SUMMARY_QUEUE_ENTRY" OWNER TO '${sharedCromwellDbRole}'; + ALTER TABLE "SUMMARY_STATUS_ENTRY" OWNER TO '${sharedCromwellDbRole}'; + ALTER TABLE "WORKFLOW_METADATA_SUMMARY_ENTRY" OWNER TO '${sharedCromwellDbRole}'; + ALTER TABLE "sqlmetadatadatabasechangelog" OWNER TO '${sharedCromwellDbRole}'; + ALTER TABLE "sqlmetadatadatabasechangeloglock" OWNER TO '${sharedCromwellDbRole}'; + + + + diff --git a/database/migration/src/main/resources/sql_metadata_changelog.xml b/database/migration/src/main/resources/sql_metadata_changelog.xml index e1f8c93e4bb..0989ec2199a 100644 --- a/database/migration/src/main/resources/sql_metadata_changelog.xml +++ b/database/migration/src/main/resources/sql_metadata_changelog.xml @@ -20,7 +20,9 @@