开发者

Agile Parallel Database Migrations

I work in an environment that is very agile. We typically have daily rollouts. That ability is necessary due to the nature of our business. Often we have updates to the database. We built a home brewed database migration library, however there is currently no concept of a version, and the migrations are not run sequentially. We have decided to refactor and run the migration sequentially, however we now find that in order to d开发者_JAVA百科o so we must create a sequence and each migration must have a unique version. How is this accomplished in an automated way in an environment where multiple developers are working in parallel?

Example: 3 branches are merged together to be promoted to staging, each branch has a data base migration to be run. How do we determine which comes before the other that requires minimal human interaction.


Woooo agile ... I work in an environment that is very it's even cooler ;)

It's not that simple, if one branch implies modifications to the schema that haven't been taken into account in the other branch etc... it'll of course fail.

What you want is a branch reconciliation solution that will handle basic cases where no collision is possible -

I.E. a piece of code that will read your SQL, find every ALTER TABLE , check that no two scripts are altering the same tables, then if it is the case, compare the alters to see if they can be combined etc.

Of course I can write that for ya but ... maybe somebody already open-sourced a "sqlmigrationscriptcombinatorofdoom".

GL ;)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜