你如何版本你的数据库架构?

2021-11-20 00:00:00 sql versioning schema mysql

您如何准备 SQL 增量?您是否手动将每个更改架构的 SQL 保存到一个 delta 文件夹,或者您是否有某种自动比较过程?

How do you prepare your SQL deltas? do you manually save each schema-changing SQL to a delta folder, or do you have some kind of an automated diffing process?

我对版本控制数据库架构和源代码的约定很感兴趣.也许是一个使架构不同的预提交钩子?

I am interested in conventions for versioning database schema along with the source code. Perhaps a pre-commit hook that diffs the schema?

此外,除了 DbDeploy 之外,还有哪些差异增量的选项?

Also, what options for diffing deltas exist aside from DbDeploy?

看到答案我想澄清我熟悉使用增量运行数据库迁移的标准方案.我的问题是关于自己创建增量,最好是自动创建.

seeing the answers I would like to clarify that I am familiar with the standard scheme for running a database migration using deltas. My question is about creating the deltas themselves, preferably automatically.

此外,版本控制适用于 PHP 和 MySQL,如果它有所不同的话.(请不要使用 Ruby 解决方案).

Also, the versioning is for PHP and MySQL if it makes a difference. (No Ruby solutions please).

推荐答案

查看

是否有数据库结构的版本控制系统变化?

如何版本我的 MS SQL 数据库SVN?

和杰夫的文章

让您的数据库处于版本控制之下

我感受到你的痛苦,我希望有一个更好的答案.这可能更接近您要查找的内容.

I feel your pain, and I wish there were a better answer. This might be closer to what you were looking for.

跟踪数据库架构变化的机制

总的来说,我觉得没有足够的、可接受的解决方案来解决这个问题,我在这方面推出了自己的解决方案.

Generally, I feel there is no adequate, accepted solution to this, and I roll my own in this area.

相关文章