Commit Graph

2 Commits

Author SHA1 Message Date
Andrei
c44ded8fd3 feat: Add automatic database backup before schema sync
Some checks failed
ParentFlow CI/CD Pipeline / Backend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Frontend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Security Scanning (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-app/maternal-app-backend dockerfile:Dockerfile.production name:backend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-web dockerfile:Dockerfile.production name:frontend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Development (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled
- Creates compressed backup before any schema changes
- Backup location: /root/maternal-app/backups/db-schema-sync
- Keeps last 10 backups automatically
- Shows restore command in summary
- Only backs up when changes will be made
- Skips backup in dry-run mode
- Pre-flight analysis to detect changes before backup

Features:
- Automatic cleanup of old backups (keeps 10 most recent)
- Compressed backups (.sql.gz) to save space
- Fallback SQL-based backup if pg_dump fails
- Backup file includes timestamp for easy identification
- Restore instructions displayed in summary

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 15:53:58 +00:00
Andrei
bdb374a567 feat: Add automatic database schema synchronization script
Some checks failed
ParentFlow CI/CD Pipeline / Backend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Frontend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Security Scanning (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-app/maternal-app-backend dockerfile:Dockerfile.production name:backend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-web dockerfile:Dockerfile.production name:frontend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Development (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled
- Created sync-database-schema.sh for automated schema sync
- Compares dev and prod databases automatically
- Creates missing tables with full schema
- Adds missing columns to existing tables
- Creates missing indexes
- Detects data type mismatches
- Includes dry-run mode for safety
- Added comprehensive documentation

Features:
- Safe dry-run mode to preview changes
- Verbose mode for detailed output
- Color-coded logging for clarity
- Automatic cleanup of temporary files
- Error handling and validation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 15:44:38 +00:00