'Some Prisma Model @@map not generating
I have a few models in my schema.prisma file that are not generating with their @@map for use in the client.
model ContentFilter {
id Int @id @default(autoincrement())
blurriness Float? @default(0.3)
adult Float? @default(0.5)
medical Float? @default(0.8)
violence Float? @default(0.5)
racy Float? @default(0.5)
party_settings_id Int @unique
party_settings PartySettings @relation(fields: [party_settings_id], references: [id])
@@map("contentfilter")
}
model PartySettings {
id Int @id @default(autoincrement())
start DateTime? @default(now())
end DateTime? @default(now())
require_location Boolean? @default(false)
require_name Boolean? @default(true)
allow_comments Boolean? @default(true)
allow_likes Boolean? @default(true)
allow_before_party Boolean? @default(false)
party_id Int @unique
party Party @relation(fields: [party_id], references: [id])
content_filter ContentFilter?
@@map("partysettings")
}
model Party {
id Int @id @default(autoincrement())
name String
hash String @unique
description String
user_id Int
user User @relation(fields: [user_id], references: [id])
images Image[]
order Order?
settings PartySettings?
@@map("party")
}
the rest of my models are available in the client by referencing them with prisma.mappedname such as prisma.party (from the example above) that table is exposed and available within the client. But both the partysettings and contentfilter is not avialable. I've ran the migrate and generate commands many times as well as deleted my database and reran migrate and generate. Could anyone help me understand what i'm doing so different in these two tables?
Solution 1:[1]
@@map
operator is used to declare the table name in the database, it doesn't affect the model names that are generated via PrismaClient
.
So as per your schema file, the name of the tables in your database would be party
, contentfilter
and partysettings
.
By default the name of the property is the lowercase form of the model name, e.g. user
for a User
model or post
for a Post
model.
Map attribute: Reference
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Nurul Sundarani |