Replies: 1 comment 7 replies
-
Can you explain how the proposed feature would be different from the existing |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
I think having migrations be generated automatic based on the schema in the models file would be very useful. A migrations folder can be created and whenever something changes in the models file - For eg: if a column is added or removed, the change can be compared with the previous migration and it can be recorded. We can have a terminal command to generate migrations.
Inspiration
This is inspired from Django where we have a models file where we can define the schema. It is written in python and it is pretty simple and extensible. Whenever the migrate command is run, the ORM records the changes done in models file and converts them into SQL statements to execute. This allows the user to have complete flexibility over the schema. The ORM detects everything which makes it easier. Even if the migrations folder is deleted, the migrations can be recovered from the current schema
Proposal
We can build this is a cargo package which has the automatic migrations compared to the current implementation where the migrations have to be written in SQL and then the models are generated.
I would prefer the other way. Let me know if you guys feel the same and if so we can build another package on top of diesel which has this automatic migrations feature. If it works well, then diesel can add this as a feature in their cargo package.
Beta Was this translation helpful? Give feedback.
All reactions