Migration hook #4607
Replies: 2 comments 4 replies
-
Note that this functionality is already implemented in Lemmy, ideally it can be upstreamed into diesel_cli. |
Beta Was this translation helpful? Give feedback.
-
Thanks for opening this discussion. From what you describe that seems to be pretty specific needs for your project. I would rather not add project specific functionality to diesel itself, but I'm open to consider more abstract functionality that could enable this if there is more than one project looking for something like that. That written: Outside of |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When running
diesel migration run
ordiesel migration revert
, ifmigrations/hooks/before_all.sql
exists, it should be executed once at the beginning, before migrations are run or reverted. The use case for Lemmy would be to have a hook that drops a temporary schema (it has functions, triggers, etc. that are recreated after therun_pending_migrations
call when runninglemmy_server
) to ensure a consistent state that the migrations are run with. If this feature is added, I'm pretty sure Lemmy will no longer need to have a custom migration CLI.Beta Was this translation helpful? Give feedback.
All reactions