Databases
Design your tables before you build
The AI invents a new table every time you add a feature, and nothing lines up.
- What you get
- A small schema you approve first: tables, the links between them, and the rules the database enforces.
- Paste it into
- Your AI tool, in your project
The prompt
Before writing any feature code, design the database for this project with me. Read what exists and what I've said the app should do. Propose the tables, what one row in each stands for, how they link, and which column identifies the owner of each row. For every table say what must be unique, what can't be empty, and what should happen to linked rows when one is deleted. Explain each decision in a plain sentence. Point out where you were unsure between two designs and what each would cost later. Wait for my OK, then write it as a migration file, not as a change made by hand in a dashboard.
Use it
Open your AI tool (Claude Code, Codex or Cursor) in your project folder and paste it in.
More in Databases
Check that users can’t read each other’s data
Every signed-in user may be able to fetch every row, and the app only hides it in the interface.
Stop changing the database by hand
You edited tables in the dashboard, and now local, preview and production don’t match.
Find out if you could get your data back
You assume the database is backed up and have never tried a restore.
Find the queries that slow your pages
Pages got slower as data grew, and adding a cache only hid it.