MiniCTRM - Build Tutorial 642: What a relational database does: tables, keys, constraints, triggers and where business rules belong
→ to begin · N for the speaker notes
On a phone: Next or a swipe left to begin, Notes for the words.
What you'll learn
An inventory of every part of your database beyond tables and columns, the rule for where a business rule lives written down and held by a test, every business limit enforced in the service that every write path goes through, the database kept to structure, and a portability check against a second database.
What a schema collects – Business rules nobody designed, where they come from, and the rule MiniCTRM keeps.
What you need first – The three lessons this one builds on, and where in a build to take it.
A database is more than tables and columns – Every part of a database, what it is, and whether it is plumbing or business; and SQLite's loose types.
Where a rule belongs – The visibility test, what goes where, and the hard parts.
An inventory of your database – Every part of your schema listed from the live database, with counts, kept current by a test.
The rule, written and tested – An ADR, four lines in CLAUDE.md, and a test that catches a new CHECK rule or trigger.
Every limit in the service – One check per limit where every write path passes, the same message on each.
A portability check – The tests on a second database in the comprehensive tier, dialect SQL behind one adapter, quiet differences pinned.
Ship it – /ship, with the inventory, the schema test and the write-path test among the rest.
How MiniCTRM did it – The SQL Query screen and the Data Model: what a user can see of a database.
Copyright 2026-2027 Brian Shydlo. MiniCTRM is source-available under the PolyForm Strict License 1.0.0 (https://polyformproject.org/licenses/strict/1.0.0): free for learning and other noncommercial use; no changes and no redistribution; commercial use needs permission.
Welcome
What a relational database is
1 / 15What a schema collects
Rules nobody designed
2 / 15What you need first
What you need first
3 / 15A database is more than tables and columns
A database is more than tables and columns
4 / 15A database is more than tables and columns
SQLite does not enforce types
5 / 15Where a rule belongs
Where a rule belongs
6 / 15Where a rule belongs
The hard parts
7 / 15An inventory of your database
An inventory of your database
8 / 15The rule, written and tested
The rule, written and tested
9 / 15Every limit in the service
Every limit in the service, every path covered
10 / 15A portability check
A portability check
11 / 15Ship it
Ship it
12 / 15How MiniCTRM did it
The SQL Query screen
13 / 15How MiniCTRM did it
The Data Model
14 / 15What you have now
What you have now
15 / 15
You have finished lesson 642, What a relational database does: tables, keys, constraints, triggers and where business rules belong.