2. Why?
Enable one-click DEV and QA environment set up
Minimize disruption and maximize the reliability of the
application and of the deployment process
Continuously deploy app without worrying about the current
state of the database
Decouple changes to DB from changes to app
3. How
Automate database initialization process
Automate deployment process
• Should be a part of continuous integration
Automate rollback process
• should be part of continuous integration on QA and DEV env
4. STEP 1:
Initializing database
Ability to reproduce the environment
Enable one-click environment set up
◦ Structure of database, schemas, tables (SQL
or DB dump)
◦ Populate the tables with reference data
(with XML/ CSV or SQL)
5. STEP 2:
Incremental
change
Versioning your database
◦ Create a table in the database that
contains its version number
◦ Every time you make a change to
the DB, create two scripts
◦ Roll-forward: That takes the database from
a version x to x+1
◦ Roll-back: x+1 to x
◦ Configuration setting for
application specifying the version
of the database it is designed to
work with
Tools:
◦ DbDeploy
◦ Flywaydb
6. STEP 3: Rolling back DB
Requirements
1. Ability to roll back without losing transactions that have been
performed since the upgrade
2. Necessity to keep the application available according to a
demanding SLA (hot deployment or zero-downtime releases)
Criteria:
1. They involve schema changes that do not lose any data (such as a
normalization or denormalization, or moving column between
tables)
2. They delete some data that only the new system understands, bit
it is not critical if this data is lost