# Database Migration & First-Run Strategy — v0.39.4-dev Consolidated

1. Freeze migrations from the reviewed model baseline using `00-FREEZE-MIGRATIONS-WINDOWS.bat` or `00-freeze-migrations-linux.sh`.
2. Review the generated migration files and migration hash output, then confirm `python manage.py makemigrations --check --dry-run` reports no drift.
3. Create a FRESH UAT database and execute all reviewed migrations (`python manage.py migrate`).
4. Create standard role groups (`bootstrap_roles`) and seed non-sensitive master/reference data (`seed_reference_data`).
5. Create Local UAT samples when requested (`seed_uat_demo_data`).
6. Create the first Super Admin interactively (`first_run_setup`).
7. Verify connectivity and seeded objects (`first_run_status`, `verify_runtime`).
8. Run Django system checks and the automated test suite before functional UAT.

### Schema freeze rule
For v0.39.4-dev Consolidated, setup must never create migrations ad hoc. The reviewed migration snapshot must be present in the package before a fresh UAT database is created. After `v1.0.0`, every schema change must be delivered as a new versioned migration; production tables must not be edited manually.
