🧭Schema Evolution
Also known as Schema Versioning
Changing the shape of data over time. Code that reads it must keep working.
Think of it like
It is like adding a new box to a paper form. Old forms still work, and they just leave it blank.
Example
An orders table gets a new coupon field. Old orders show it as empty. Reports that never used it keep working.
Why it matters
Data changes because the business changes. One renamed field can break many reports in one night.
Definition
Example code
sql
ALTER TABLE orders ADD COLUMN coupon_code TEXT;Common mistake
Key takeaways
- 1Add, do not rename. New fields are safe. Renames break readers.
- 2Old rows still read. Old data must still load the right way.
- 3Check first. Test each change before it ships.