File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments