First Migration Cycle¶
Once your first model works, the next milestone is a repeatable migration workflow.
This page shows the default path used in most Edgy projects.
Prerequisite¶
Make sure Edgy can resolve your app instance.
Use one of:
--app path.to.moduleEDGY_DEFAULT_APP=path.to.modulepreloadsin custom settings
See Application Discovery for details.
Standard Cycle¶
graph LR
A["edgy init"] --> B["edgy makemigrations -m '<message>'"]
B --> C["Review generated revision"]
C --> D["edgy migrate"]
D --> E["edgy current / edgy check"]
Step-by-Step¶
1. Initialize migration repository¶
$ edgy init
2. Generate migrations from model changes¶
$ edgy makemigrations -m "Initial schema"
3. Apply migrations¶
$ edgy migrate
4. Validate migration state¶
$ edgy current
$ edgy check
Why This Order Matters¶
initcreates the migration environment once.makemigrationscaptures model deltas explicitly.migrateapplies those deltas to the target database.currentandcheckprevent drift between code and schema.
Troubleshooting¶
If auto-discovery fails, start commands with:
$ edgy --app myproject.main migrate
If multiple heads appear:
$ edgy heads
$ edgy merge -m "Merge heads" <rev_a> <rev_b>