TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Tool to Test Django Migrations

3 点作者 sobolevn超过 5 年前

1 comment

djrobstep超过 5 年前
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).