CLAUDE: Add --clean flag to production database sync
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 <noreply@anthropic.com>
This commit is contained in:
parent
76ce9f3c47
commit
b39066e06d
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user