Skip to content

Commit

Permalink
chore: Make the script and guide more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
k3yss committed Aug 30, 2024
1 parent 15b0e7a commit b1e44c2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
3 changes: 1 addition & 2 deletions docs/pg-migration-guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,9 @@ Get the promoted instance PG15 connection string by running
$ tofu output --raw source_instance > pg_connection.txt
```


```sh
#TODO | Need to do a dry run again
$ ./postgres-perms-update.sh <db-name-whose-perms-we-want-to-be-fixed>
$ ./postgres-perms-update.sh <main.tf directory> <db-name-whose-perms-we-want-to-be-fixed>
```

# Step 4: Promote the instance
Expand Down
2 changes: 1 addition & 1 deletion modules/postgresql/gcp/bin/create-dms.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -ex
set -e

# the directory we want to run the script in
dir=${1}
Expand Down
10 changes: 8 additions & 2 deletions modules/postgresql/gcp/bin/postgres-perms-update.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/usr/bin/env bash
set -ex
set -e

dir=${1}
DB_NAME=${2}

pushd ${dir}

DB_NAME=${1}
NEW_OWNER=${DB_NAME}-user
# READ PG_CON from a file
PG_CON=$(cat pg_connection.txt)
Expand Down Expand Up @@ -29,3 +33,5 @@ for sequence in $sequences; do
done

echo "Ownership of all tables in $DB_NAME has been granted to $NEW_OWNER."

popd
2 changes: 1 addition & 1 deletion modules/postgresql/gcp/bin/terraform-db-swap.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -ex
set -e

dir=${1}
module_prefix=${2}
Expand Down
2 changes: 1 addition & 1 deletion modules/postgresql/gcp/bin/terraform-state-rm.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -ex
set -e

dir=${1}
module_prefix=${2}
Expand Down

0 comments on commit b1e44c2

Please sign in to comment.