Generate migration code from entities #645
Replies: 3 comments 2 replies
-
|
Hope has this feature too, just like #332 , I really hope to have a function like Now, my project has 16 tables which are really hard to write migration files by hand, and I need to spend lots of time checking and ensuring the code runs correctly. |
Beta Was this translation helpful? Give feedback.
-
|
I think SeaORM prefers a schema-first approach (that's just an opinion). |
Beta Was this translation helpful? Give feedback.
-
|
Closed in favor of #2889 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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
So I think that adding this feature will help both error-prune and develop performance
Additional Information
Beta Was this translation helpful? Give feedback.
All reactions