migra icon indicating copy to clipboard operation
migra copied to clipboard

Support content diffing also

Open djrobstep opened this issue 6 years ago • 3 comments

This would be nice, but a lot of work and entirely new functionality.

migra's main purpose is generating schema migration scripts, which don't need all content diffed, so this functionality might be better as a plugin, or separate project.

There's no way I'll have time to work on this myself in the near future, but leaving this here aspirationally.

djrobstep avatar Feb 16 '18 07:02 djrobstep

Hi @djrobstep : I have a question related to content. I’m not sure how to get this question to you, here seems as good a place as any!

It looks like Migra is great for getting schemas in sync, but what about the data? When I write a Django migration I can also specify what should happen to the data: for example updating foreign keys, remapping old values, and so on. It sucks having to commit every migration file into the codebase, but it’s necessary that to get from A to D you have to apply the A->B->C data migrations.

harrybiddle avatar Jan 09 '20 13:01 harrybiddle

@harrybiddle if you need data changes you simply add those to your auto-generated script as necessary.

If you are managing a single database, then often these scripts are one-offs and you won't ever need them again. But if you're supporting multiple external databases then you may need to keep a chain of them around to ensure an upgrade path for multiple versions.

A good way to keep things simple is to make data change scripts idempotent so that you can just run them whenever - that reduces the coupling to a particular migration.

djrobstep avatar Jan 09 '20 22:01 djrobstep

That makes sense, thanks. I read your presentation and noted that you pointed out the "chain of migration" scripts as a downside of the Django approach, and I was confused how you could specify data migrations without doing this.

Looking forward to giving this project a whirl soon!

harrybiddle avatar Jan 31 '20 11:01 harrybiddle