-
-
Notifications
You must be signed in to change notification settings - Fork 661
Description
Summary
sea-orm-cli migrate init should generate migration files from entities
In this example setting-up-migration, sea-orm only generate m20220101_000001_create_table.rs which is a sample migration file. If there are pre-defined entities, it should generate those migration files too(in this case m20220120_000001_create_post_table.rs).
In the case of the maintenance phase, generating an alter_table file is also needed. If a certain entity is changed, it should find the create_table file of that entity, and based on that file, the alter_table file should be generated.
Motivation
Currently, if I use the code-first approach in sea-orm, I should write code to generate tables that fit into my entities. There are several problems with that
- There is the possibility that I mismatch entities and code.
- If I change the entity, I should change the migration code too
So I think that adding this feature will help both error-prune and develop performance