简体   繁体   English

适用于Node和MySQL的数据库版本控制工具

[英]Database versioning tool for Node and MySQL

Is there a solution that helps you manage database schema patches, preferably that runs in Node. 是否有解决方案可帮助您管理数据库架构补丁,最好在Node中运行。 I am looking at node-db-migrate which has support for MySQL but I want to be able to run plain vanilla SQL on it instead of using wrapper functions offered by this package. 我正在查看具有MySQL支持的node-db-migrate,但我希望能够在其上运行普通的香草SQL,而不是使用此软件包提供的包装函数。

Is there a solution that offers the same functionality but also lets you have plain SQL in patches? 有没有提供相同功能但还允许您在补丁程序中使用普通SQL的解决方案?

I'm personally a fan of Sequelize, which has a (poorly named) sister project called Umzug designed to handle migrations. 我个人是Sequelize的粉丝,Sequelize拥有一个名为Umzug的姊妹项目,旨在处理迁移。 You can absolutely run vanilla SQL in a package like this, but be very careful doing so. 您可以在这样的程序包中绝对运行香草SQL,但要非常小心。 Running raw SQL can be an easy way to do something like populate a new column with data (perhaps a new summary column that needs to be filled with the results of a more complex query you've been running until now). 运行原始SQL是执行诸如用数据填充新列之类的简单方法(也许是一个新的摘要列,其中需要填充您一直在运行的更复杂查询的结果)。 However, it can also make it very easy to make mistakes if you do this for things like ALTER TABLE . 但是,如果您对诸如ALTER TABLE类的东西执行此操作,也很容易出错。 Whenever you can, it's best to use provided constructs for things like that. 只要有可能,最好对此类事情使用提供的构造。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM