// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema generator client { provider = "prisma-client-js" binaryTargets = ["linux-musl", "debian-openssl-3.0.x"] } datasource db { provider = "postgresql" url = env("DATABASE_URL") } model Ad { uuid String @id @default(uuid()) @db.Uuid userUuid String @db.Uuid status Status @default(PENDING) driver Boolean passenger Boolean frequency Frequency fromDate DateTime @db.Date toDate DateTime @db.Date schedule ScheduleItem[] seatsProposed Int @db.SmallInt seatsRequested Int @db.SmallInt strict Boolean createdAt DateTime @default(now()) updatedAt DateTime @default(now()) @updatedAt waypoints Waypoint[] pause Boolean @default(false) comment String? @@map("ad") } model ScheduleItem { uuid String @id @default(uuid()) @db.Uuid adUuid String @db.Uuid day Int time DateTime @db.Time(4) margin Int createdAt DateTime @default(now()) updatedAt DateTime @default(now()) @updatedAt Ad Ad @relation(fields: [adUuid], references: [uuid], onDelete: Cascade) @@map("schedule_item") } model Waypoint { uuid String @id @default(uuid()) @db.Uuid adUuid String @db.Uuid position Int @db.SmallInt lon Decimal @db.Decimal(9, 6) lat Decimal @db.Decimal(8, 6) name String? houseNumber String? street String? locality String? postalCode String? country String createdAt DateTime @default(now()) updatedAt DateTime @default(now()) @updatedAt Ad Ad @relation(fields: [adUuid], references: [uuid], onDelete: Cascade) @@map("waypoint") } enum Frequency { PUNCTUAL RECURRENT } enum Status { PENDING VALID INVALID SUSPENDED }