P
Prisma3mo ago
acidjazz

prisma client generates model with no create

model Session {
id Int @id @default(autoincrement())
userId Int
user User @relation(fields: [userId], references: [id])
token String @unique
ip String @default("127.0.0.1")
agent String @default("")
// coordinate Unsupported("Point")
coordinate String @default("30.2423 : -97.7672")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("sessions")
}
model Session {
id Int @id @default(autoincrement())
userId Int
user User @relation(fields: [userId], references: [id])
token String @unique
ip String @default("127.0.0.1")
agent String @default("")
// coordinate Unsupported("Point")
coordinate String @default("30.2423 : -97.7672")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("sessions")
}
can anyone tell me why i dont get a prisma.session.create ? Property 'create' does not exist on type 'SessionDelegate<DefaultArgs>'.ts(2339)
8 Replies
Rev
Rev3mo ago
did you already make the prisma generate?
acidjazz
acidjazz3mo ago
yes when I Rename the table to something else - it works :shrug:
Rev
Rev3mo ago
I dont know the reason, must have a restricted word in prisma for "Session"
jonfanz
jonfanz3mo ago
don't have the docs page handy but generally if a create isn't generated that's because of an Unsupported field. I see you have one but commented out, maybe it wasn't truly removed.
Nurul
Nurul3mo ago
Prisma Schema API | Prisma Documentation
API reference documentation for the Prisma Schema Language (PSL).
acidjazz
acidjazz3mo ago
when that unsupported field was uncommneted, teh create would work, but absolutely zero crud stuff would work since prisma doesnt support spatial - since requested in 2020 Everything works fine now that the table is named Tokens :shrug:
Nurul
Nurul3mo ago
I am glad to hear that now everything works!
acidjazz
acidjazz3mo ago
Thanks but you might want to check out why the word Session/Sessions is somehow reserved
Want results from more Discord servers?
Add your server