Initial T3 scaffold with models, API helpers, and dashboard
This commit is contained in:
@@ -1,34 +1,20 @@
|
||||
model Device {
|
||||
id String @id @default(uuid())
|
||||
imei String @unique
|
||||
name String?
|
||||
telemetry Telemetry[]
|
||||
@@map("devices")
|
||||
// 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"
|
||||
}
|
||||
|
||||
model Telemetry {
|
||||
id String @id @default(uuid())
|
||||
deviceId String
|
||||
device Device @relation(fields: [deviceId], references [id])
|
||||
recordedAt DateTime @default(now)
|
||||
lat Float
|
||||
lng Float
|
||||
altitude Float?
|
||||
speed Float?
|
||||
heading Float?
|
||||
accuracy Float?
|
||||
battery Float?
|
||||
isCarOn Boolean?
|
||||
raw Json?
|
||||
@@map("telemetry")
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model Command {
|
||||
id Int @id @default(autoincrement())
|
||||
deviceId String
|
||||
device Device @relation(fields: [deviceId], references [id])
|
||||
type String
|
||||
payload Json
|
||||
createdAt DateTime @default(now())
|
||||
@@map("commands")
|
||||
}
|
||||
model Post {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([name])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user