matcher/prisma/schema.prisma

64 lines
1.9 KiB
Plaintext

// 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"]
previewFeatures = ["postgresqlExtensions"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
extensions = [postgis]
}
model Ad {
uuid String @id @db.Uuid
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
driverDuration Int?
driverDistance Int?
passengerDuration Int?
passengerDistance Int?
waypoints Unsupported("geography(LINESTRING)")?
direction Unsupported("geography(LINESTRING)")?
fwdAzimuth Int
backAzimuth Int
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
@@index([driver])
@@index([passenger])
@@index([fromDate])
@@index([toDate])
@@index([fwdAzimuth])
@@index([direction], name: "direction_idx", type: Gist)
@@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")
}
enum Frequency {
PUNCTUAL
RECURRENT
}