Defining your data model
Course: Prisma - chapter 6
Prisma expects you to define the shape of your data in the schema.prisma file
Section titled “Prisma expects you to define the shape of your data in the schema.prisma file”
If your final app will have a Users table, it would look like this in the schema.prisma file
model User { id Int @id @default(autoincrement()) username String @unique password String firstName String lastName String}Assignment
Section titled “Assignment”Add a Users and a Todo table in your application. Don’t worry about foreign keys / relationships just yet

Answer
// This is your Prisma schema file,// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client { provider = "prisma-client-js"}
datasource db { provider = "postgresql" url = env("DATABASE_URL")}
model User { id Int @id @default(autoincrement()) username String @unique password String firstName String lastName String}
model Todo { id Int @id @default(autoincrement()) title String description String done Boolean @default(false) userId Int}Generate migrations
Section titled “Generate migrations”You have created a single schema file. You haven’t yet run the CREATE TABLE commands. To run those and create migration files , run
npx prisma migrate dev --name Initialize the schemaYour DB should now have the updated schema.
💡 Check the
prisma/migrationsfolder and check if you see anything interesting in there