P
Prisma5mo 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
Rev5mo ago
did you already make the prisma generate?
acidjazz
acidjazzOP5mo ago
yes when I Rename the table to something else - it works :shrug:
Rev
Rev5mo ago
I dont know the reason, must have a restricted word in prisma for "Session"
jonfanz
jonfanz5mo 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
Nurul5mo ago
Prisma Schema API | Prisma Documentation
API reference documentation for the Prisma Schema Language (PSL).
acidjazz
acidjazzOP5mo 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
Nurul5mo ago
I am glad to hear that now everything works!
acidjazz
acidjazzOP5mo 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