umami/prisma/schema.prisma
2020-07-18 23:54:25 -07:00

64 lines
1.7 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model event {
created_at DateTime? @default(now())
event_id Int @default(autoincrement()) @id
event_type String
event_value String
session_id Int
url String
website_id Int
session session @relation(fields: [session_id], references: [session_id])
website website @relation(fields: [website_id], references: [website_id])
@@index([created_at], name: "event_created_at_idx")
}
model pageview {
created_at DateTime? @default(now())
referrer String?
session_id Int
url String
view_id Int @default(autoincrement()) @id
website_id Int
session session @relation(fields: [session_id], references: [session_id])
website website @relation(fields: [website_id], references: [website_id])
@@index([created_at], name: "pageview_created_at_idx")
}
model session {
browser String?
country String?
created_at DateTime? @default(now())
hostname String?
language String?
os String?
screen String?
session_id Int @default(autoincrement()) @id
session_uuid String @unique
website_id Int
website website @relation(fields: [website_id], references: [website_id])
event event[]
pageview pageview[]
@@index([created_at], name: "session_created_at_idx")
}
model website {
created_at DateTime? @default(now())
hostname String
website_id Int @default(autoincrement()) @id
website_uuid String @unique
event event[]
pageview pageview[]
session session[]
}