phonemigrate Command
Thephonemigrate command migrates all existing player phone data from the legacy database tables to the metadata backup system. This is essential when transitioning from database-stored phone data to the item-based metadata system.
Usage
When to Use
Use this command when:- Switching to Metadata Mode: You’re enabling
Config.UseMetadata = truefor the first time and want to preserve existing player data - Data Preservation: Before wiping legacy database tables, to ensure all player data is backed up
- Server Migration: When moving to a new server and want to provide players with their historical data
What Gets Migrated
The command creates a backup for each player containing:| Data Type | Source Table | Limit |
|---|---|---|
| Contacts | roadshop_contacts | All |
| Messages | roadshop_messages | Last 500 |
| Notes | roadshop_notes | All |
| Photos | roadshop_camera | Last 300 (non-deleted) |
| Call History | roadshop_calls | Last 200 |
How It Works
1
Discovery
The command scans all RoadPhone database tables to find unique player identifiers.
2
Backup Creation
For each player with data, a “migration” type backup is created in the
roadshop_backups table.3
Skip Duplicates
Players who already have a migration backup are automatically skipped (safe to run multiple times).
4
Progress Reporting
Progress is displayed every 10 players with ETA and statistics.
Console Output
Statistics Explained
| Statistic | Description |
|---|---|
| Total players | Number of unique identifiers found across all data tables |
| Backups created | Players who had data and received a new migration backup |
| Already migrated | Players skipped because they already have a migration backup |
| No data to backup | Players found in tables but with no actual data (empty records) |
| Errors | Failed backup attempts (check console for specific errors) |
Restoring Migration Backups
After migration, players can restore their data through the phone’s Settings → Backup feature. Migration backups appear alongside regular backups with the name “Migration Backup”.Migration backups are stored per player identifier, not per phone number. This means players can restore their data to any new phone they acquire.
Technical Details
Database Table Used
Backup Data Structure
Performance Considerations
- The command runs in a background thread to avoid blocking the server
- A 50ms delay is added between each player to prevent database overload
- Estimated time: ~50ms per player (1000 players ≈ 50 seconds)
Requirements
Config.BackupEnabled = true is not required for migration. The command works independently.The
roadshop_backups table must exist. Run the SQL migrations if you haven’t already.Safe to Run Multiple Times
The command is idempotent - running it multiple times will not create duplicate backups. Players who already have a migration backup are automatically skipped.Troubleshooting
”No player data found”
This means no records were found in the RoadPhone database tables. Either:- The tables are empty (fresh server)
- The tables don’t exist (run SQL migrations)
- Wrong database connection
Errors during migration
Check the server console for specific error messages. Common issues:- Database connection problems
- Table structure mismatches
- Disk space issues (JSON data can be large)