Defining Models and Migrations
5 min read
Module Overview
What You’ll Learn
- Define models in
schema.prismawith fields and types - Generate and run migrations with
prisma migrate dev - Use the generated Prisma Client to confirm a migration worked
💡 Why this module matters: Module 3 got Prisma connected, this module puts it to work, defining real models and turning them into real database tables through migrations, the core workflow every Prisma project runs on.
What’s Covered
- Defining models, fields, types, and attributes in
schema.prisma. - Running migrations,
prisma migrate dev, and what it actually does to the database. - The generated Prisma Client, regenerated automatically after each migration.
- Migration history, how Prisma tracks and applies schema changes over time.
Hands-On
By the end of this module, you’ll have defined real models in schema.prisma, migrated them into a real PostgreSQL database, and confirmed the resulting tables through Prisma Client.
Next module: modeling relationships between those models.