Documentation
Database

Update schema

To update your database schema, you can simply edit the schema.prisma file in the /packages/database library. You can find more information about the Prisma schema file here.

To add an entity for "posts" for example, you can add the following to your schema:

model Post {
  id        String      @id @default(cuid())
  title     String
  content   String
  author    User     @relation(fields: [authorId], references: [id])
  authorId  String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}

Push your changes to the database

To push your changes to the database, you can run the following command:

pnpm db:push

Generate prisma client

After you have pushed your schema changes, you need to re-generate the prisma client. You can do this by running the following command:

pnpm db:generate

On this page