Skip to content

Commit 80db830

Browse files
committed
Incrementally testing GH action.
1 parent e93bada commit 80db830

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

.github/workflows/duplicate-prod-db.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,16 @@ jobs:
9797
# in a way that avoids locking the database and works from GCP itself (so no traffic leaves GCP).
9898
gcloud sql export sql $DB_INSTANCE_NAME gs://$DUMP_BUCKET_NAME/qa-db-dump-backup.sql --database=$SOURCE_DATABASE_NAME --quiet
9999
100+
# Delete the existing database
101+
gcloud sql databases delete $DEST_DATABASE_NAME --instance=$DB_INSTANCE_NAME --quiet
102+
103+
# Create a the new database
104+
gcloud sql databases create $DEST_DATABASE_NAME --instance=$DB_INSTANCE_NAME
105+
100106
# Import the dump into the QA database
107+
# The exported sql contains statements that require authentication as user postgres.
108+
# In theory we could dump the DB without these statements, with:
109+
# pg_dump --no-owner --no-privileges -d your_database > clean_dump.sql.
110+
101111
export PGPASSWORD=$DEST_DATABASE_PASSWORD
102112
gcloud sql import sql $DB_INSTANCE_NAME gs://$DUMP_BUCKET_NAME/$DUMP_FILE_NAME --database=$DEST_DATABASE_NAME --user=$DEST_DATABASE_USER --quiet

0 commit comments

Comments
 (0)