4 ms·
I keep meaning to pick up Rust, still looking for some entry point that's interesting enough to get me off my butt. How (well) does diesel deal with migrations
by hinkley 9y ago
I keep meaning to pick up Rust, still looking for some entry point that's interesting enough to get me off my butt.
How (well) does diesel deal with migrations? I've seen other ORMs fall down the stairs trying to deal with schema modification over time.
- steveklabnik 9y agoYou write raw SQL files that do exactly what you want them to do: https://github.com/rust-lang-nursery/thanks/tree/master/migrations https://github.com/rust-lang-nursery/thanks/tree/master/migr... each of these has an up.sql and a down.sql "diesel migraiton run" will run all pending migrations, there's revert/redo as well. "diesel migration generate" can generate these files and directories for you; it doesn't yet (that I know of) have helpers to write the SQL though (like Rails does for its migrations). On deploy, it runs the migrations first https://github.com/rust-lang-nursery/thanks/blob/master/build.rs#L19 https://github.com/rust-lang-nursery/thanks/blob/master/buil... I believe there are some interesting improvements coming down the line in the future, but for now, it works pretty well.