Stage 2 · Lesson 9 of 10
Prisma or Drizzle: schema and migrations
In projects there are two usual choices. generates a typed client for you from a schema.prisma file. defines tables in TypeScript and stays close to plain SQL.
Both can generate files, the scripts that change your tables, whenever you change the schema. In development, prisma migrate dev or drizzle-kit generate creates them. Commit the SQL files and read them before applying.
In production, run prisma migrate deploy or drizzle-kit migrate. The migration history is what lets development, CI and production all reach the same schema.
Common trapediting a migration that has already run, or making a in one step, such as renaming a column while old code still uses it. Instead, add the new column, copy the data, switch the code, then drop the old one.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking Relational Database Design and Modeling
Design Gurus · Intermediate · $98 one-time
The modelling and normalisation decisions that stay with a codebase for years
- CourseFreeCS50's Introduction to Databases with SQL
Harvard University · Beginner
Free course from querying through schema design, indexes, transactions and scaling
Practise
Also worth your time
- Database Indexing Explained: B-Tree, Hash, Bitmap, R-Tree, and When to Use Each (opens in a new tab)Read
B-tree and composite indexes, plus the leftmost-prefix rule that trips people up
What sits under your queries: storage engines, transactions and isolation levels