2020-07-17 10:03:38 +02:00
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
|
|
|
datasource db {
|
|
|
|
provider = "postgresql"
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
|
|
|
|
2020-07-23 05:45:09 +02:00
|
|
|
model account {
|
|
|
|
created_at DateTime? @default(now())
|
|
|
|
is_admin Boolean @default(false)
|
|
|
|
password String
|
|
|
|
updated_at DateTime? @default(now())
|
|
|
|
user_id Int @default(autoincrement()) @id
|
|
|
|
username String @unique
|
|
|
|
website website[]
|
|
|
|
}
|
|
|
|
|
2020-07-17 10:03:38 +02:00
|
|
|
model event {
|
|
|
|
created_at DateTime? @default(now())
|
|
|
|
event_id Int @default(autoincrement()) @id
|
|
|
|
event_type String
|
|
|
|
event_value String
|
2020-07-19 08:54:25 +02:00
|
|
|
session_id Int
|
2020-07-17 10:03:38 +02:00
|
|
|
url String
|
2020-07-19 08:54:25 +02:00
|
|
|
website_id Int
|
|
|
|
session session @relation(fields: [session_id], references: [session_id])
|
|
|
|
website website @relation(fields: [website_id], references: [website_id])
|
2020-07-18 04:33:40 +02:00
|
|
|
|
|
|
|
@@index([created_at], name: "event_created_at_idx")
|
2020-07-23 05:45:09 +02:00
|
|
|
@@index([session_id], name: "event_session_id_idx")
|
|
|
|
@@index([website_id], name: "event_website_id_idx")
|
2020-07-17 10:03:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
model pageview {
|
|
|
|
created_at DateTime? @default(now())
|
|
|
|
referrer String?
|
2020-07-19 08:54:25 +02:00
|
|
|
session_id Int
|
2020-07-17 10:03:38 +02:00
|
|
|
url String
|
|
|
|
view_id Int @default(autoincrement()) @id
|
2020-07-19 08:54:25 +02:00
|
|
|
website_id Int
|
|
|
|
session session @relation(fields: [session_id], references: [session_id])
|
|
|
|
website website @relation(fields: [website_id], references: [website_id])
|
2020-07-18 04:33:40 +02:00
|
|
|
|
|
|
|
@@index([created_at], name: "pageview_created_at_idx")
|
2020-07-23 05:45:09 +02:00
|
|
|
@@index([session_id], name: "pageview_session_id_idx")
|
|
|
|
@@index([website_id], name: "pageview_website_id_idx")
|
2020-07-17 10:03:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
model session {
|
2020-07-19 08:54:25 +02:00
|
|
|
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[]
|
2020-07-18 04:33:40 +02:00
|
|
|
|
|
|
|
@@index([created_at], name: "session_created_at_idx")
|
2020-07-23 05:45:09 +02:00
|
|
|
@@index([website_id], name: "session_website_id_idx")
|
2020-07-17 10:03:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
model website {
|
2020-07-19 08:54:25 +02:00
|
|
|
created_at DateTime? @default(now())
|
2020-07-25 02:00:56 +02:00
|
|
|
label String
|
2020-07-23 05:45:09 +02:00
|
|
|
user_id Int
|
2020-07-19 08:54:25 +02:00
|
|
|
website_id Int @default(autoincrement()) @id
|
|
|
|
website_uuid String @unique
|
2020-07-23 05:45:09 +02:00
|
|
|
account account @relation(fields: [user_id], references: [user_id])
|
2020-07-19 08:54:25 +02:00
|
|
|
event event[]
|
|
|
|
pageview pageview[]
|
|
|
|
session session[]
|
2020-07-17 10:03:38 +02:00
|
|
|
}
|