The problem isn't how to build it. The problem is that the database is the first place where a pipe becomes a wall. The moment the first row of a real customer is saved in it, every change to the structure is no longer a prompt. It's a data migration.
What a database is, in one line
The system's memory. Everything the system needs to know tomorrow, after the user closed the browser, is there. And whatever isn't saved there, the system doesn't know. No matter what the screen shows.
And from that comes the first decision, before any table.
Decision 1: what even counts as a "thing" in the system
Working with a resort booking system taught me this the hard way. The system knew how to count rooms: three out of five occupied. The number was right. Then someone asked: which room? And it turned out the system didn't know. It stored "room type", not "a specific room". I wrote about it here.
The AI chose the simple structure, because nobody told it otherwise. And both structures work in the demo. Only one of them works on the day a guest asks for the room with the view.
A database doesn't store what exists in the world. It stores what you decided exists.
So before the tables: what are the "things" in your system, and what exactly is each of them? Is a booking for a person or for a family? Is a product an item or a model? Is a customer a person or a company with several people? Each of these questions sounds trivial, and each one is a wall.
Decision 2: what's the source of truth
Every important piece of data needs one place where it's true. The payment: at the payment provider, or with you? Availability: in your system, or in a Google calendar? The price: on the pricing page, or in the table?
When there are two places, they will drift apart. Not if, when. And then someone will see one thing on the screen and another on the invoice.
An example that comes up again and again: you raise a subscription price. Does the system even know that whoever signed up last year paid a different price? If the price is stored in only one place, the answer is no. The full case here.
Decision 3: what happens when something is deleted
"Delete" sounds like a button. In practice it's a decision with at least three answers: really delete, hide, or delete the person and keep the invoices. And each answer has a price: legal, financial, and in trust. The full case here.
The AI will build a delete button that works. What it does when someone presses it, probably nobody decided.
What's a pipe and what's a wall
- Pipe: column names, field order, indexes, a few helper tables. All cheap to change, even after launch.
- Wall: what counts as a "thing" in the system, what the source of truth is, what gets deleted and how, and what personal data is stored at all. Once there are customers, every change here is a migration, and sometimes a conversation with a customer.
And the price of getting it wrong here isn't a bug. It's data already saved the wrong way, that has to be fixed backwards. That's the most expensive part of maintaining systems built fast.
What to ask the AI
Before you create tables, write me a list: what the "things" in the system are, and what exactly each of them is. For every important piece of data, what the source of truth is. And what happens when each thing is deleted. Mark every place where you assumed something I didn't say.
The last line is the important one. It turns the AI's silent assumptions into a list you can read.
How you know it holds
Not by the screen showing the right thing. By attempts that can fail:
- Change a price, and check that whoever already paid still sees their price.
- Delete a customer, and check what remains: the bookings, the invoices, the files.
- Ask the system the most specific question a real customer will ask, and check it has an answer. "Which room?", not "how many rooms?".
A database doesn't break on the day you build it. It breaks on the day someone asks a question you didn't think of.
Next in the series: users and permissions. And if you want to go through this in order on your own system, The Judgment Map does exactly that, and asks you at every decision instead of deciding for you.