Unknown model· unknown
from ShareGPT 90K (shared ChatGPT conversations)
I need a schema.prisma for a postgres DB for a laundry app
- User
I need a schema.prisma for a postgres DB for a laundry app
- Assistant
Sure, here's a sample schema for a laundry app using Prisma that you can use as a starting point:
codemodel User { id Int @default(autoincrement()) @id email String @unique password String name String role Role @default(USER) laundry Laundry[] createdAt DateTime @default(now()) } model Laundry { id Int @default(autoincrement()) @id name String address String user User @relation(fields: [userId], references: [id]) userId Int services Service[] createdAt DateTime @default(now()) } model Service { id Int @default(autoincrement()) @id name String price Float laundry Laundry @relation(fields: [laundryId], references: [id]) laundryId Int createdAt DateTime @default(now()) } model Order { id Int @default(autoincrement()) @id user User @relation(fields: [userId], references: [id]) userId Int laundry Laundry @relation(fields: [laundryId], references: [id]) laundryId Int service Service @relation(fields: [serviceId], references: [id]) serviceId Int status OrderStatus @default(PENDING) createdAt DateTime @default(now()) } enum Role { USER ADMIN } enum OrderStatus { PENDING IN_PROGRESS COMPLETED }This schema includes the following models:
- User: represents a user of the app. Each user has a unique email and password, as well as a name and a role (either
USERorADMIN). Users can have multiple laundries associated with them. - Laundry: represents a laundry business. Each laundry has a name and an address, and is associated with a single user. Laundries can offer multiple services.
- User: represents a user of the app. Each user has a unique email and password, as well as a name and a role (either