Version control records and manages changes to application code and database definitions. For database work, treat the schema as regular code and store every update in one source control system. section 10.1
Use version control for database schemas because it provides:
- A change history for tracing schema state when reproducing production bugs. section 10.1
- A single source of truth that keeps database changes aligned with regular code. section 10.1
- A rule that prevents database-structure modifications outside source control. section 10.1
Avoid the model database
A dedicated model database accumulates schema changes, then production deployments compare against it and generate upgrade scripts. This creates competing sources of truth and loses traceable history. Storing schema updates in Git removes that duplication. section 10.1
Figure 10.1. Having a dedicated instance as a model database is an anti-pattern. The database schema is best stored in a source control system.
Compare the dedicated model-database anti-pattern with storing the schema in source control. section 10.1
























