how are you? I need your help, I can't figure out why my 'const newPlace = await prisma.place.create({}) doesn't have a "create" option for my model below:
I have other tables that work, the create option appears, I need to know why only this 'place' model does not have the create option?
my 'schema.prisma' below
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
binaryTargets = "native"
previewFeatures = ["extendedIndexes", "improvedQueryRaw"]
}
model place {
id Int @id(map: "place_pk") @default(autoincrement())
place_id String @db.VarChar
name String @db.VarChar(255)
nationalPhoneNumber String? @db.VarChar(20)
internationalPhoneNumber String? @db.VarChar(20)
formattedAddress String? @db.VarChar(255)
plusCode_globalCode String? @db.VarChar(20)
plusCode_compoundCode String? @db.VarChar(255)
latitude Float?
longitude Float?
rating Float?
pricelevel Float? @db.Real
googleMapsUri String? @db.VarChar(255)
websiteUri String? @db.VarChar(255)
instagram String? @db.VarChar(255) @unique
utcOffsetMinutes Int?
adrFormatAddress String? @db.VarChar(1000)
businessStatus String? @db.VarChar(20)
userRatingCount Int?
iconMaskBaseUri String? @db.VarChar(255)
iconBackgroundColor String? @db.VarChar(20)
displayName String? @db.VarChar(255)
primaryTypeDisplayName String? @db.VarChar(255)
takeout Boolean?
delivery Boolean?
dineIn Boolean?
reservable Boolean?
servesBeer Boolean?
liveMusic Boolean?
servesCocktails Boolean?
restroom Boolean?
goodForGroups Boolean?
goodForWatchingSports Boolean?
acceptsCreditCards Boolean?
acceptsDebitCards Boolean?
acceptsCashOnly Boolean?
acceptsNfc Boolean?
route String? @db.VarChar
street_number String? @db.VarChar
sublocality_level_1 String? @db.VarChar
administrative_area_level_1 String? @db.VarChar
administrative_area_level_2 String? @db.VarChar
postal_code String? @db.VarChar
country String? @db.VarChar
events event[]
favorite favorite_place[]
location Unsupported("geography(Point, 4326)")
photos place_photo[]
active Boolean @default(true)
instagram_business instagram_business?
@@unique([place_id], map: "place_un")
@@index([id])
@@index([location], name: "location_idx", type: Gist)
}
Solved: as I am using PostGis from Postgres, my field
location Unsupported("geography(Point, 4326)")is causing thecreatefunction to disappear.Solution: included location as optional with '?' at the end, as follows: location
Unsupported("geography(Point, 4326)")?