Keeping development, testing and production aligned.
WHAT DIVERGES
Schema, when changes are made by hand Configuration Data volume Versions
WHY THAT MATTERS
Code tested against one schema fails against another.
WHAT PREVENTS IT
Every change made as a migration, applied everywhere in order.
WHAT TO NEVER DO
Change production by hand.
WHY
The change exists nowhere else, and is lost on the next rebuild.
WHAT TO DO IF AN EMERGENCY CHANGE IS MADE
Write the migration immediately afterwards.
WHAT TO VERIFY
That every environment is at the same migration version.
HOW
Compare the migration tracking table.
WHAT ELSE TO COMPARE
The actual schema, periodically.
WHY BOTH
Migrations can succeed and still leave differences, through manual intervention.
WHAT TOOLS PROVIDE
Schema comparison between two databases.
WHAT TO DO WITH DIFFERENCES
Investigate each, rather than forcing one to match.
WHY INVESTIGATE
The difference may be the only record of something intentional.
WHAT TO KEEP IDENTICAL
The database version Character sets and collations Strict mode settings
WHY STRICT MODE SPECIFICALLY
Permissive settings accept data that production rejects, and the failure appears only at release.