Show HN: Rambler – A simple and language-independent SQL schema migration tool
github.com
github.com
While I wish the tool had been implemented in something other than perl (with 10 million CPAN dependencies), I like that DDL files are versioned and organized in ways more meaningful to the structure of the database rather than being bound to the timeline of the database.
If I am going to do migrations, a tool like Rambler would have to compare favorably to Flyway (https://flywaydb.org/), which is pretty solid.
I use it with PostgreSQL and I don't use a separate database for the registry. I do have a separate schema for the registry in the same database as the data, but I would want that sort of organization no matter the case. If the database you use doesn't include some sense of "schema" below the database level of separation, I could see how that would be annoying from an administrative/maintenance point of view (or on hosted database solutions).
https://github.com/rubenv/sql-migrate
I'm not sure which tool came first in the Go community. While I'm not a big Go fan, this is precisely how Go can be handy sometimes, by allowing easy distribution of tools that don't depend on an interpreter or a JVM...
I agree with the easy distribution thing, Go is awesome for this kind of things. I only wish the cross-compilation of binaries that embed C would be easier (XGo is the thing for tkhe moment).
I kind of wish I had kept developing http://jdc0589.github.io/mite/ the feature set is pretty solid even though much of its isn't documented in the site, but I got to the point I wasn't working with sql databases much anymore, so the interest kind of died off.
Besides needing the jvm installed, are there any differences between rambler and flyway command line [1] that make it a more suitable choice?
Besides supporting many more databases, Flyway's parser is also much more robust with support for all kinds of database specific things like changing delimiters with MySQL, Oracle PL/SQL, PotsgreSQL COPY FROM STDIN, T-SQL, ...
And you can use truly plain SQL files like the ones generated from your DB's dump tool as a starting point, no special comments required.
(And of course you also have things like repeatable migrations, Java-based migrations (great for complex data transformations), API and build tool integration, ...)
However if failed migrations are a big concern for you, do yourself a favor and consider moving to a database that offers proper DDL transactions like PostgreSQL, SQL Server or DB2. Flyway runs every migration inside a transaction and this way changes become truly atomic without any sneaky implicit commits (I'm looking at you Oracle and MySQL).
* https://github.com/mattes/migrate
Migrates is another thing, and I like it more except for the lack of configuration file.
To be honest, I have always tried to avoid Go ORMs after a bad experience with gorm, but the whole package is looking very interesting for reducing the boilerplate involved in Go CRUD applications without having to buy into a complexity risk. It's worth a look.
[1] https://github.com/markbates/pop
The more important problem in DB migrations is transforming the content (usually involves application code) and resolving relational changes (i.e. 'in v2 all users are a member of a group').
Some large companies handle migrations by versioning the data and branching the code to handle every version. Another alternative is to 'migrate on read'.
Both of those options sound worse on paper than an all-at-once migration but one-shot upgrades can be expensive and dangerous on large databases. Dealing with data-versions explicitly also makes sense for data that's stored client-side and periodically synced.
What do you mean? That's like saying "most commits don't need to be reverted".
This is true - but when something does break unexpectedly in a production migration, the last thing you want to do is figure out how to do your revert/'down' on the fly.
I agree, in which case, you don't have to write a down section.
Anyway, rambler isn't targeted at "large companies with huge databases", which of course have more complex database migrations methods.
In that case, I'll stick with my ORM solution.