production data migration patterns in continuous delivery

后端 未结 2 1879
野性不改
野性不改 2021-02-02 01:50

What are relational database (and schema) migration patterns on production in continuous delivery?

In many traditional developments the DBA arranges a big migration scri

2条回答
  •  说谎
    说谎 (楼主)
    2021-02-02 02:08

    Flyway works great for continuous delivery/deployment. Many clients use it across all environments, including production.

    The single most important thing for cascading DB migrations across environments is to have a 3 step process:

    Step 1

    Old application code works together with old DB.

    Step 2

    New application code get deployed, and migrates DB on startup. This migration must be backwards-compatible so that old application code still works with the new DB. This is essential because:

    • you can then do rolling upgrades, upgrading one node at a time until all nodes have the new application code
    • rollback immediately to the old application code if the new one is broken

    This step may involve compatibility views and triggers to do the job.

    Step 3

    After the changes have been proven to work, the next version of the application code gets deployed together with the necessary DB migrations to discard any remaining outdated (from step 1) and compatibility (from step 2) structures.

提交回复
热议问题