Enhanced seeding system #1072
DenuxPlays
started this conversation in
Ideas
Replies: 2 comments
-
Key difference to migrations: Besides the features I want to implement there is one other key difference: migrations are keept inside another folder/crate which does not allow me to access my custom code inside them so it only makes them useful for basic schema migration. In my case: |
Beta Was this translation helpful? Give feedback.
0 replies
-
Had you both time to look at this? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey,
since I created two prs regarding to improve the seeding system and a few questions came up I wanted to focus my motivation here.
My plan is to improve the seeding system to have something like symfony fixtures.
Currently it is only possible to seed via files which will fail if you need to generate data/ids or execute other code somehow.
So my first pr is to allow the execution of rust code.
My second pr was to pass AppContext to the seed function instead of just the db to allow more functionality to the user.
Further plans are:
This would immensely improve the dx and the whole fixtures/seeding feature of loco.
But it would also introduce a few breaking changes (change the file format of the seeding file to add the ability to add tags and env requirements and ofcourse the change from the DatabaseConnection to AppContext)
Ofcourse would be available to create prs and maintain the features in the future.
And ofcourse everything can be implemented by using the hooks but I think more users can take advantage of it which is why I am proposing it as a new feature.
CC: @kaplanelad
Ref issues:
seed
function inHook
should get AppContext as an argument. #1060Ref prs:
Beta Was this translation helpful? Give feedback.
All reactions