Fixture Sync Overview
Complete Copy
All dataSchema + Records
Clean Start
Test DB initializationConsistent environment
Fast Execution
pg_dump + pg_restoreEfficient copy
Auto Execution
Auto after importManual also available
pnpm sonamu fixture sync
Copies all data from Fixture DB to Test DB.Basic Usage
- Completely initializes Test DB
- Dumps Fixture DB
- Restores to Test DB
How It Works
Internal Implementation
Execution Process
Usage Scenarios
1. After Fixture Changes
2. Test DB Initialization
3. Team Synchronization
Database Comparison
pg_dump Options
-Fc (Format Custom)
Dumps in binary format for speed and efficiency.- Compressed, smaller size
- Selective restore possible with
pg_restore - Fast speed
—no-owner —no-acl
Excludes owner and permission information.- Users may differ between local and remote
- Prevents permission conflicts
Auto vs Manual
Auto Sync
Sync is automatically called when runningpnpm sonamu fixture import:
Manual Sync
Run directly when needed:Workflow
Typical Development Flow
Fixture Sharing Flow
Performance Optimization
1. Local Fixture DB
Sync is faster when running Fixture DB locally:2. Minimal Data
Keep only necessary data in Fixture:Best Practices
1. Regular Sync
2. CI/CD Integration
3. Add Scripts
Troubleshooting
Connection Failed
- Check network connection
- Check Fixture DB server status
- Check firewall settings