// book 32
patriola.com

Book 32 · Patriola’s Guide to Claude

Build a Database


Claude proposes schemas, pushes back on normalization shortcuts, derives index strategy from real query patterns, and generates the query layer. The human decides and executes. This book documents what that looks like on two deployed production systems.

Buy Ebook on Amazon

Patriola's Guide to Claude — Build a Database: Schema Design, Indexing, and Live Migrations
What this book is

Schema design with Claude as a working partner

Using Claude as a schema design partner changes how databases get built. Claude proposes schemas from natural language requirements, pushes back on normalization shortcuts, derives index strategy from real query patterns, and generates the query layer with parameterized queries throughout. The human decides and executes — Claude proposes and argues.

This book documents that process across two real production systems: KaspaFAQ, a live domain FAQ running on SQLite with a Claude-assisted content pipeline, and FantasticFights, a deployed trading card game database on MySQL 5.7 with compound filter queries, FULLTEXT search, and 60+ keyword abilities in a junction table.

Covers the full arc from requirements to live queries: engine choice, schema design, normalization decisions, composite index strategy, PHP query layer, full-text search, schema verification, and live migration discipline with rollback scripts drafted before anything runs. For readers who already know SQL and want to understand what changes when Claude is in the room.

What you’ll learn

Two real systems, one complete arc

  • Engine choice — SQLite vs. MySQL for the use case at hand: what questions to ask, what Claude surfaces that you might skip, and how the choice affects everything downstream.
  • Schema design — Requirements to tables: how Claude proposes structure, where it pushes back on shortcuts, and where its first proposal needs correction from domain knowledge you hold.
  • Normalization decisions — Not all normalization is right for all systems. The book covers the specific places where KaspaFAQ and FantasticFights deviated and why.
  • Composite index strategy — Deriving index strategy from real query patterns: which columns to index, in which order, and how Claude reasons about compound filter queries in FantasticFights.
  • PHP query layer — Generating parameterized queries, structuring the data access layer, and the patterns Claude uses to keep the query layer consistent across both systems.
  • FULLTEXT search — MySQL FULLTEXT on KaspaFAQ: configuration, the query, and the tradeoffs against LIKE-based search for a content FAQ use case.
  • Schema verification — Confirming the deployed schema matches the design before running migrations, and the specific checks Claude generates.
  • Live migration discipline — Rollback scripts drafted before the migration runs, the sequencing rules for ALTER TABLE on a live database, and what Claude gets right vs. where you override it.
From the book

A preview

Claude does not know your production traffic. It knows what you told it about your query patterns. The gap between those two things is where index strategy goes wrong. The discipline is to give Claude the real queries — the ones that run on the deployed system — not a description of what you think runs.
You Should I use FULLTEXT or LIKE for the KaspaFAQ search?
Claude For a content FAQ on SQLite, LIKE with a leading wildcard is a full-table scan on every search. FULLTEXT on MySQL gives you relevance ranking and stops the scan. The question is whether you need ranking or just presence. If a user searching “validator rewards” should see the most relevant FAQ entry at the top rather than the first match in insertion order, FULLTEXT earns its complexity. If the FAQ is small enough that insertion order is acceptable, LIKE works and keeps the schema simpler. What’s your expected row count at steady state?
Who it’s for

SQL developers adding Claude to their design process

This book is for readers who already know SQL and want to understand what changes when Claude is in the room during schema design. It documents real decisions on deployed systems — the places where Claude’s proposal was right, the places where it was wrong, and the places where it asked a question that reframed the design. Prior SQL knowledge is assumed throughout.

A longer excerpt is available to newsletter subscribers.

Buy Ebook on Amazon

Stay current

New books in this series

One short email per book launch.