Strange type error in seeding file
I have a strange issue with my seeding file.
title is insisting
Type 'string | number' is not assignable to type 'string'.
but my schema and migration files clearly state title is a string. Where is this coming from? It's really strange.
2 Replies
Hey @smykes 👋
Can you check if the BOOK_DATA json file has a
title
field which consists a number?Of course, the data export decided the Orwell book 1984 should be a number and not a string. Leaving this open as I will have another question I believe. Thank you @Nurul guess I'm writing a migration file
If there is no VARCHAR type, how should I get around this @Nurul
I think it might be
title String @db.VarChar(200)
Nope that wasn't it. How do I do a varchar?
So I changed my schema to generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Book {
id String @id @default(uuid())
author String
avg_rating Int
book_id Int
createdAt DateTime @default(now())
date_read String
isbn String
isbn_13 String
month_read Int
number_of_pages Int
publisher String
shelf String
title String @db.VarChar(200)
user_rating Int
year_read Int
}
and still getting the same typescript error, not sure what to do