Open carols10cents opened 7 years ago
There's nothing in Diesel that just tells you if there's pending migrations or not, no. There is http://docs.diesel.rs/diesel/migrations/fn.run_pending_migrations.html
if you'd rather just automatically run them. I can definitely add a "are there any pending migrations" function to 0.13 though. Long term I actually want to add an "assert that the schema matches what Diesel was compiled against/thinks it is" type function, but I haven't implemented it yet.
I'm used to the behavior in rails whereupon if you try to start your server and there are migrations that haven't been made to the database yet, the server will bail right away and tell you to go run them.
Right now, if I forget to run migrations, I may or may not get an error immediately, depending on if I happen to make a request that expects the database to be different or not. I've also been bitten by this enough that now I know "oh hey i probably just need to run migrations", but in the past (especially with rails' reloading where you don't have to restart the server when you get new code) I and other people have gone on wild goose chases when getting weird database errors that were caused by outstanding migrations.
In production, the procfile runs migrations just before starting the server every time, and the tests automatically run outstanding migrations, so this is mostly for development.
Is this possible/easy with diesel, @sgrif ?