Hacker News new | ask | show | jobs
by wwweston 2691 days ago
How did it come to be that some portion of the industry use the term "migration" to describe changes/updates to a database?

As far as I can tell, it's a really poor fit. It generates the expectation that movement of existing schema + maybe data from one host to another or one environment to another. What's usually happening instead is essentially a schema diff / mutation.

3 comments

Because when you change the representation of data at rest, you need to "migrate" that data to the new representation.

I agree that schema changes are not migration, but I think the author correctly uses the word "migration" to mean migrating their data in the database to some new schema representation.

This is true, but it's a bit of an implementation detail. All I'm doing is a schema change; a migration is what the database does under the hood to facilitate it.
The database doesn't know how to perform a data migration for you, however. Sometimes it's possible to do it in SQL as part of the schema upgrade but that isn't always possible, in which case you need to implement it in the application. But regardless of how you implement it, it's still "data migration" because you're migrating data from one representation to another and your database won't always know how to do that "under the hood" for you.
I guess it is because you migrate data between application versions. And sometimes this means simply applying an SQL script file, sometimes you also combine this with upgrading the DB server itself, then you might also need to do the whole export-import dance (async replication + export-upgrade-import on a secondary instance, then promote that instance and either drop the old and create a new secondary, or do the same exp-imp on the old-primary).

Good question though, it could be "schema upgrade", but sometimes there's a downgrade, so somehow people started calling it migration.

And it's especially important to note, that users don't care about the schema, operators care a bit, developers slightly more, and if there is a dedicated DBA in the loop, now that person might finally really care about it, but they rarely write the migration scripts. And developers care about data. (At least that's my impression.)

The word “replication” is used when replicating the data from one location to another. Maybe it depends on your industry but everywhere I’ve worked in software, migration has meant changing the schema and data and replication has meant moving to to another location.

I do agree that the terminology could be better, but it seems to be fairly standardised now.