1
0
mirror of https://github.com/kremalicious/umami.git synced 2024-12-23 18:04:47 +01:00
umami/prisma/schema.mysql.prisma

86 lines
2.4 KiB
Plaintext
Raw Normal View History

2020-07-17 10:03:38 +02:00
generator client {
provider = "prisma-client-js"
}
datasource db {
2020-08-12 09:23:03 +02:00
provider = "mysql"
2020-07-17 10:03:38 +02:00
url = env("DATABASE_URL")
}
2020-07-23 05:45:09 +02:00
model account {
user_id Int @default(autoincrement()) @id
username String @unique
2020-08-07 04:14:44 +02:00
password String
is_admin Boolean @default(false)
created_at DateTime? @default(now())
updated_at DateTime? @default(now())
2020-07-23 05:45:09 +02:00
website website[]
}
2020-07-17 10:03:38 +02:00
model event {
event_id Int @default(autoincrement()) @id
2020-08-07 04:14:44 +02:00
website_id Int
2020-07-19 08:54:25 +02:00
session_id Int
2020-08-07 04:14:44 +02:00
created_at DateTime? @default(now())
2020-07-17 10:03:38 +02:00
url String
2020-08-07 04:14:44 +02:00
event_type String
event_value String
2020-07-19 08:54:25 +02:00
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 {
view_id Int @default(autoincrement()) @id
2020-07-19 08:54:25 +02:00
website_id Int
2020-08-07 04:14:44 +02:00
session_id Int
created_at DateTime? @default(now())
url String
referrer String?
2020-07-19 08:54:25 +02:00
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-08-07 04:14:44 +02:00
session_id Int @default(autoincrement()) @id
session_uuid String @unique
website_id Int
2020-07-19 08:54:25 +02:00
created_at DateTime? @default(now())
hostname String?
2020-08-07 04:14:44 +02:00
browser String?
2020-07-19 08:54:25 +02:00
os String?
2020-08-12 09:23:03 +02:00
device String?
2020-07-19 08:54:25 +02:00
screen String?
2020-08-07 04:14:44 +02:00
language String?
country String?
2020-07-19 08:54:25 +02:00
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
website_id Int @default(autoincrement()) @id
website_uuid String @unique
2020-08-07 04:14:44 +02:00
user_id Int
2020-08-12 09:23:03 +02:00
name String
domain String?
2020-08-12 09:23:03 +02:00
created_at DateTime? @default(now())
2020-08-15 10:17:15 +02:00
share_id 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-08-12 09:23:03 +02:00
@@index([user_id], name: "website_user_id_idx")
2020-07-17 10:03:38 +02:00
}