Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upStep towards automatically reversible migrations #1583
Comments
This comment has been minimized.
|
This has been discussed at length (I think it's usually been in the context of "I want Rust migrations" rather than this, but in my eyes the only reason to have Rust migrations is for auto-revert). Ultimately based on my experience maintaining Rails, I don't think that the value gained by getting revert for free outweighs the maintenance cost of having a Rust DSL for migrations. It's been a hotspot of bugs for Rails for the entirety of my involvement with that project, and the DSL still only handles a small subset of what is possible in SQL. That said, I designed our migration API to allow for other forms of migrations to exist, and have set up plans for how third party crates would add new forms. Barrel is looking like it will be the first external migration system to do that integration. While I'm happy to help implement non-SQL migrations and have the small amount of code in Diesel required to integrate third party crates that do so, I do not think this feature makes sense for Diesel itself at this time. |
sgrif
closed this
Mar 3, 2018
This comment has been minimized.
moore3071
commented
Mar 4, 2018
|
Thanks for the quick response. The extensible route of allowing other crates to provide new migration formats is probably the best route; I'll be sure to check out Barrel. |
moore3071 commentedMar 3, 2018
It would be nice if Diesel could get to a place where the user doesn't need to write the
downfunction. This is at a glance a very difficult problem when migrations are purely SQL, and in fact ActiveRecord and Django's ORM have their migrations written as code.The best route for Diesel to (generally) eliminate the need for
downis to add a modified query builder for migrations. I'd imagine that this would make four possibilities for what's included in a migration directory:up.sqlanddown.sqlfor backwards compatibilitymigration.rsfor a migration that Diesel can reverse (this could beup.rsfor consistency)up.rsanddown.rsfor a migration that Diesel's query builder can handle reversing, but Diesel can't figure out how to reverseup.rsanddown.sqlfor a migration that Diesel can't figure out how to reverse