开发者

Track MySQL schema changes in git (using ALTER TABLE, not mysqldump)

开发者 https://www.devze.com 2023-03-20 00:53 出处:网络
I frequently write code changes (PHP) that go along with a schema change. This requires a few steps: Develop the new code, adding new columns as needed.

I frequently write code changes (PHP) that go along with a schema change. This requires a few steps:

  1. Develop the new code, adding new columns as needed.
  2. Add new columns or change schema on live.
  3. Deploy new code on live.
  4. Migrate data from old columns to new columns, if required.
  5. Delete old columns.

Is there an easy way to do this with git?

What if more than one of these sequences need to be done? That complicates using the same file for changes, as the second commit would开发者_开发技巧 wipe out the changes for the first.

Help! :D


You might find this tool helpful: https://github.com/ruckus/ruckusing-migrations


There is a product called DeltaSQL, you might try it out. It is a great tool for version tracking SQL.

0

精彩评论

暂无评论...
验证码 换一张
取 消