Database Version Control for MySQL

后端 未结 4 1426
别那么骄傲
别那么骄傲 2020-12-19 15:38

What method do you use to version-control your database? I\'ve committed all our database tables as separate .sql scripts to our respository (mercurial). In that way, if any

4条回答
  •  不思量自难忘°
    2020-12-19 15:48

    You can use sqitch. Here is a tutorial for MySql, but it is actually database agnostic.

    Changes are implemented as scripts native to your selected database engine... Database changes may declare dependencies on other changes—even on changes from other Sqitch projects. This ensures proper order of execution, even when you’ve committed changes to your VCS out-of-order... Change deployment is managed by maintaining a plan file. As such, there is no need to number your changes, although you can if you want. Sqitch doesn’t much care how you name your changes... Up until you tag and release your application, you can modify your change deployment scripts as often as you like. They’re not locked in just because they’ve been committed to your VCS. This allows you to take an iterative approach to developing your database schema. Or, better, you can do test-driven database development.

提交回复
热议问题