Unit 02 of 03
The Data Layer
The model layer that maps table rows to objects, migrations that change the schema version by version, relationships between records and validations that stop a record before it is written, chained queries, the per-request query cache and the N+1 query problem.
Published Updated
Lessons
- 01 Object–Relational Mapping Measures the layer that maps a table row to an object and a table to a model; shows that a saved value is read by another client too and where the model of this core reaches its limit. 15 min read
- 02 Migrations Measures migrations, which change the table schema version by version; shows that an added column stays persistent, does not reach old rows, and why migrations are numbered. 12 min read
- 03 Relationships and Validations Measures validations that stop a record before it is written and the one-to-many relationship that links records; shows that a validation error stays only in this request and differs from a notice message. 11 min read
- 04 The Query Interface and the N+1 Problem Measures how many queries go to the database: the query cache stays in this request, the N+1 problem and its fix with eager loading, and the way the cache stores an empty result too. 14 min read