Regenerate prisma type

I added some extra fields on the model and ran yarn rw prisma migrate dev but the typing did not sync up.

For example:
From

model Category {
  id               Int        @id @default(autoincrement())
  name             String     @unique
  parentCategoryId Int?
  parentCategory   Category?  @relation("ParentSubCategories", fields: [parentCategoryId], references: [id])
  subCategories    Category[] @relation("ParentSubCategories")
}

To

model Category {
  id               Int        @id @default(autoincrement())
  name             String     @unique
  imageId          Int?
  image            Image?     @relation(fields: [imageId], references: [id])
  parentCategoryId Int?
  parentCategory   Category?  @relation("ParentSubCategories", fields: [parentCategoryId], references: [id])
  subCategories    Category[] @relation("ParentSubCategories")
  createdAt        DateTime   @default(now())
  createdBy        Int?
  creator          User?      @relation("CategoryCreator", fields: [createdBy], references: [id])
  updatedAt        DateTime   @default(now()) @updatedAt
  updatedBy        Int?
  updater          User?      @relation("CategoryUpdater", fields: [updatedBy], references: [id])
}

As you can see, the typing still not updated.

Is it I missed out any other command?

Next time you run your dev server the types will be generated again.

If you want to trigger it manually you can run yarn rw g types

Hope this helps!

1 Like