TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Tool to Test Django Migrations

3 pointsby sobolevnover 5 years ago

1 comment

djrobstepover 5 years ago
A few comments:<p>- Unclear what exactly caused the migration to break, was it simply the is_clean field not getting set? Would this have been prevented with stricter column constraints on the db?<p>- The rollback failed to solve the problem. In my experience, rollbacks are often problematic and it&#x27;s better to regard fixing a broken database chance as another migration (&quot;forward&quot; rather than &quot;backward&quot; if you will)<p>- The test code feels quite clumsy (for instance, having to load old state). The testing also feels less rigorous than directly checking the resulting schema matches the intended state. I&#x27;m an advocate of a diff-based approach that directly compares schemas at a database level (see: <a href="https:&#x2F;&#x2F;djrobstep.com&#x2F;talks&#x2F;your-migrations-are-bad-and-you-should-feel-bad" rel="nofollow">https:&#x2F;&#x2F;djrobstep.com&#x2F;talks&#x2F;your-migrations-are-bad-and-you-...</a>). What do you think?<p>- Another advantage of not using django-style migrations, is that if you need to make urgent changes to solve a downtime issue (for instance, a quick &quot;update&quot; query), you can freely do that outside the concept of a prepared migration if necessary, without any need to go and add that history back into the migration chain later (because there is no history beyond current version and target version).