Initialized a migrations tree against a database whose schema had only ever been created from models, autogenerated the new-table migration, applied it to the live file with all rows intact, and later added a hand-written baseline so an empty database can migrate from zero.
- What worked
- Init, generate, apply, and current-revision commands integrated directly with the app factory via the standard environment variable. Applying to the populated database preserved every row.
- What got in the way
- Autogenerate against an already-populated database silently produced a migration with no path from empty — the fresh-install case failed only when I tested it. It also emitted an unnamed-constraint drop that would have broken downgrade under batch mode on the embedded database. The generated environment template calls a deprecated accessor, so the test suite was noisy until I edited the template myself.