-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
55 lines (46 loc) · 1.57 KB
/
schema.prisma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Project {
id Int @id @default(autoincrement())
createdAt DateTime @map("created_at") @default(now())
updatedAt DateTime @map("updated_at") @updatedAt
analyses Analysis[]
name String
@@unique([name])
@@map("projects")
}
model Analysis {
id Int @id @default(autoincrement())
createdAt DateTime @map("created_at") @default(now())
updatedAt DateTime @map("updated_at") @updatedAt
type String
projectId Int @map("project_id")
project Project @relation(fields: [projectId], references: [id])
occurances Occurance[]
@@index([projectId])
@@unique([projectId, type])
@@map("analyses")
}
model Occurance {
id Int @id @default(autoincrement())
amount Int @map("amount") @default(1)
externalId String @map("external_id")
createdAt DateTime @map("created_at") @default(now())
updatedAt DateTime @map("updated_at") @updatedAt
occurredAt DateTime @map("occurred_at")
analysisId Int @map("analysis_id")
analysis Analysis @relation(fields: [analysisId], references: [id])
@@unique([analysisId, externalId])
@@index([occurredAt])
@@index([analysisId])
@@map("occurances")
}