Design a QBCore data migration script
A safe script is specific to a documented source schema and an exact target commit. Generate it only after comparing your database with SQL shipped by the target repositories.
Requirements
- Idempotent or guarded operations
- Explicit transaction boundaries where supported
- Row counts and rejected-row reporting
- No destructive drop until rollback retention expires
- Dry-run mode for transformations
- Backup identifier and source/target commit recorded in the log
Execution sequence
- Restore a production-shaped backup into staging.
- Run precondition queries and capture row counts.
- Apply schema additions before data transformation.
- Transform a bounded batch and validate application behavior.
- Complete the migration, then compare counts and constraints.
- Run the first-boot and domain smoke tests.
- Prove rollback using the backup, not an untested reverse script.
The current baseline schema is visible in qb-core/qbcore.sqlΒ ; other resources can ship their own SQL.