Hacker News new | ask | show | jobs
by zumachase 2140 days ago
We've got a core product running on Django, and one thing the author doesn't mention is testing migrations. The migration system is wonderful, except for the difficulty in testing migrations. There's no sane/official way to do this. And it's such an important thing that I don't get why the Django crew haven't tackled it.
3 comments

I've used django-test-migrations before and was really happy with it. https://pypi.org/project/django-test-migrations/
We've played around with that and it's on the roadmap. But it just adds another set of fixtures to herd.
What sort of proposal would you put forth? I generally install one of my production backups onto a staging server (secured appropriately for production data), and run the migrations against it to test.
That's not the intention on the code, I thought he is talking around writing a migration and a test that ensures the data migration is correctly applied
My strategy here is to have a staging server where migrations are applied before they can hit production.

As someone else pointed out, migration without CI can be dangerous and difficult to coordinate with deployment.

This is what we do but it's too manual for my taste.