From b39066e06dba68f1c6b8fbdbad14b214ae565c2b Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Thu, 23 Oct 2025 16:52:42 -0500 Subject: [PATCH] CLAUDE: Add --clean flag to production database sync MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use pg_dump --clean to drop existing objects before recreating them, ensuring a cleaner sync without conflicts from existing objects. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- scripts/sync_from_prod.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/sync_from_prod.sh b/scripts/sync_from_prod.sh index f0ce63d..37f1d04 100755 --- a/scripts/sync_from_prod.sh +++ b/scripts/sync_from_prod.sh @@ -41,9 +41,10 @@ echo "Testing local database connection..." pg_isready -h sba_postgres -U ${SBA_DB_USER} -d ${SBA_DATABASE} || error_exit "Local database is not ready" # Create dump from production server first (safer than direct pipe) +# Using --clean to drop existing objects before recreating them echo "Creating dump from production server..." ssh -o StrictHostKeyChecking=no akamai \ - "cd container-data/sba-database && source .env && docker exec -e PGPASSWORD=\$SBA_DB_USER_PASSWORD sba_postgres pg_dump -U \$SBA_DB_USER -d \$SBA_DATABASE" \ + "cd container-data/sba-database && source .env && docker exec -e PGPASSWORD=\$SBA_DB_USER_PASSWORD sba_postgres pg_dump --clean -U \$SBA_DB_USER -d \$SBA_DATABASE" \ > /tmp/prod_dump.sql || error_exit "Failed to create production database dump" # Verify dump file is not empty