gb db sync
Sync database from staging or production to your Genbox.
Synopsis
gb db sync [options]Description
Copies database contents from a source environment (staging/production) to your Genbox. Useful for testing with real data.
Options
| Option | Description |
|---|---|
--source <env> | Source environment: staging or production |
--include <list> | Only sync specific collections |
--exclude <list> | Exclude specific collections |
--name <env> | Target Genbox environment |
--dry-run | Show what would be synced |
-y, --yes | Skip confirmation |
Examples
Sync from Staging
gb db sync --source stagingSync from Production
gb db sync --source productionSelective Sync
# Only sync specific collections
gb db sync --source staging --include users,products,orders
# Exclude large collections
gb db sync --source staging --exclude logs,analytics,sessionsPreview
gb db sync --source staging --dry-runCollection Filtering
Include Pattern
# Specific collections
--include users,products
# Pattern matching
--include "user*,product*"Exclude Pattern
# Exclude logs
--exclude logs,audit_logs
# Exclude temporary data
--exclude "temp*,cache*"Safety Features
Production Safeguards
When syncing from production:
- Confirmation required
- Read-only snapshot used
- PII masking option available
- Audit logging
⚠️ Syncing from PRODUCTION
This will copy data from production to your Genbox.
Production data may contain sensitive information.
Type 'yes' to confirm: _Data Masking
# Mask sensitive fields
gb db sync --source production --mask email,phone,ssnProgress Output
Syncing database from staging...
Collections:
âś“ users 1,234 documents (2.1 MB)
âś“ products 5,678 documents (12.3 MB)
âś“ orders 3,456 documents (8.7 MB)
â—‹ bookings syncing... 45%
· payments
· notifications
Progress: 4/6 collections (23.1 MB / 45.2 MB)Notes
- Large databases may take several minutes
- Existing data is replaced (not merged)
- Indexes are recreated
- Use
--dry-runto preview size
See Also
gb restore-db- Restore from local backupgb backup- Create backupgb create- Create with database options
Last updated on