如何加速单次(最后一次)迁移测试?

发布于 2024-09-16 08:58:24 字数 86 浏览 3 评论 0原文

我正在根据测试编写迁移 SQL。因为迁移是最后一个,而且我们有大约 300 个迁移,所以到达那里非常慢,因为它每次都是从下往上迁移。有什么想法可以加快速度吗?

I'm writing my migration SQL against tests. Because the migration is the last one and we've got about 300 migrations, it's DAMN SLOW to get there, as it migrates from bottom up every time. Any ideas how to speed this up a bit?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

悸初 2024-09-23 08:58:24

如果您的所有系统都已更新到最新的迁移,并且您预计不需要运行任何以前的系统,请考虑展平它们:您可以获取 schema.rb 的内容并复制它到新的合并迁移,并删除 300 个旧迁移。

在你的成长过程中,这可能对你暂时有效;然后在完成后恢复它们。

If all your systems are up to date with the latest migration and you don't foresee needing to run any of the previous ones, consider flattening them: you can take the contents of schema.rb and copy it to a new consolidated migration, and delete the 300 old ones.

This might work for you even temporarily while you develop; then restore them when you're done.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文