Re:Surviving Django, if you care about databases
by zumachase on Thursday August 06, 2020 @05:15PM
(#24075533)
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.
[ Parent
| on HN ]
Re:Surviving Django, if you care about databases
by _AzMoo on Thursday August 06, 2020 @05:50PM
(#24075848)
I've used django-test-migrations before and was really happy with it. https://pypi.org/project/django-test-migrations/
Re:Surviving Django, if you care about databases
by zumachase on Thursday August 06, 2020 @08:49PM
(#24076898)
We've played around with that and it's on the roadmap. But it just adds another set of fixtures to herd.
Re:Surviving Django, if you care about databases
by ensignavenger on Thursday August 06, 2020 @05:20PM
(#24075579)
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.
Re:Surviving Django, if you care about databases
by jordic on Thursday August 06, 2020 @05:35PM
(#24075707)
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
Re:Surviving Django, if you care about databases
by dvarrazzo on Thursday August 06, 2020 @06:37PM
(#24076166)
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.