Aerich is an official migration tool for Tortoise ORM. It tracks changes in your models and applies them incrementally to the database schema.
Key Features of Aerich
Versioned Migrations: Keeps track of schema changes with versioned migration files.
Safe for Data: Updates the schema without dropping tables, preserving existing data.
Rollbacks: Allows rolling back migrations if needed.
When Can You Use generate_schemas?
Directly using generate_schemas is fine only when:
The database is still in the development phase, and you are okay with losing data.
You're working on a new table or project where no production data exists.
For any project with existing data or in production, always use migrations with aerich.
Migration Workflow Summary
Use aerich for incremental and safe schema updates.
Avoid generate_schemas unless you're starting fresh or okay with losing all data.
For schema changes, update your models, generate migrations with aerich, and then apply them.
Aerich is an official migration tool for Tortoise ORM. It tracks changes in your models and applies them incrementally to the database schema.
Key Features of Aerich
When Can You Use generate_schemas? Directly using generate_schemas is fine only when:
Migration Workflow Summary