I find there's two things which Object-Relational Mappers like Django's provides. One infrequently useful one is relatively constructing queries from user input.

The other is versioning of your database schema, allowing you to easily upgrade and downgrade your databases. Not all ORMs provide this, but handcoding that logic I miss it.

Also I hear many developers don't like SQL's syntax, but I think that's a mix of it being overpowered for them and them haven't really had tried it.

I actually find it kind of silly that with all the AI hype, modern "noSQL" databases tend to be dumber then what existed before.

There is after all significant overlap between my "AI" education and relational database query planners.

But I would be interested in knowing whether there's a tool focused on generating database migration scripts. I doubt I could use it now for Odysseus without breaking things, but I do wish I knew about such a tool.

@alcinnz Data migration is one of those tasks where using the full power of SQL comes in pretty handy. It also isn't something I easily trust to tooling - tools don't really understand your data, after all.

In a sense I wonder if we're even talking about the same thing. What kind of migrations did you have in mind that can be easily automated?

@ayo The situation I have with Odysseus is that Odysseus keeps local databases on everyone's computers and I have to make sure they're upgraded to the latest schema corresponding to the version you're running. So far that's mostly involved adding tables and columns.

I've got a script which does this on startup, but I have frequently found it doesn't deal well with branches operating on different schema versions.

@alcinnz Ah okay, adding tables and columns is indeed relatively simple - I've often dealt with transformations of existing data, which automation isn't likely to get right.

With different branches, do you mean that your database schema evolution isn't linear? I've toyed with diesel.rs, which seems to treat each migration as separate and independent, but dealing with non-linear evolution feels pretty fragile even with that.

@ayo I've kept my migrations linear, just sometimes I don't want to explicitly think about these migrations when I don't have to.

The bigger problem is that I do find branches useful for developing the code around it. But when I branch the surrounding code I have to think about whether the wrong migrations will be applied. And about whether I am about to branch the migrations.


@alcinnz So far I've always been able to make the code in my active branches work with the most recent version of the database schema (and "the most recent database schema" hasn't been ambiguous so far), but I can indeed see how things can get complex and confusing pretty fast.

@ayo I can see that, if you keep your schema + migrations outside your application code.

Sign in to participate in the conversation

Welcome to your niu world ! We are a cute and loving international community O(≧▽≦)O !