1
0
mirror of https://github.com/kremalicious/umami.git synced 2024-12-30 08:47:44 +01:00
umami/prisma/schema.mysql.prisma
2021-03-20 23:01:10 +11:00

88 lines
3.2 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
model account {
user_id Int @id @default(autoincrement()) @db.UnsignedInt
username String @unique @db.VarChar(255)
password String @db.VarChar(60)
is_admin Boolean @default(false)
created_at DateTime? @default(now()) @db.Timestamp(0)
updated_at DateTime? @default(now()) @db.Timestamp(0)
website website[]
}
model event {
event_id Int @id @default(autoincrement()) @db.UnsignedInt
website_id Int @db.UnsignedInt
session_id Int @db.UnsignedInt
created_at DateTime? @default(now()) @db.Timestamp(0)
url String @db.VarChar(500)
event_type String @db.VarChar(50)
event_value String @db.VarChar(50)
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")
@@index([session_id], name: "event_session_id_idx")
@@index([website_id], name: "event_website_id_idx")
}
model pageview {
view_id Int @id @default(autoincrement()) @db.UnsignedInt
website_id Int @db.UnsignedInt
session_id Int @db.UnsignedInt
created_at DateTime? @default(now()) @db.Timestamp(0)
url String @db.VarChar(500)
referrer String? @db.VarChar(500)
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")
@@index([session_id], name: "pageview_session_id_idx")
@@index([website_id, created_at], name: "pageview_website_id_created_at_idx")
@@index([website_id], name: "pageview_website_id_idx")
@@index([website_id, session_id, created_at], name: "pageview_website_id_session_id_created_at_idx")
}
model session {
session_id Int @id @default(autoincrement()) @db.UnsignedInt
session_uuid String @unique @db.VarChar(36)
website_id Int @db.UnsignedInt
created_at DateTime? @default(now()) @db.Timestamp(0)
hostname String? @db.VarChar(100)
browser String? @db.VarChar(20)
os String? @db.VarChar(20)
device String? @db.VarChar(20)
screen String? @db.VarChar(11)
language String? @db.VarChar(35)
country String? @db.Char(2)
website website @relation(fields: [website_id], references: [website_id])
event event[]
pageview pageview[]
@@index([created_at], name: "session_created_at_idx")
@@index([website_id], name: "session_website_id_idx")
}
model website {
website_id Int @id @default(autoincrement()) @db.UnsignedInt
website_uuid String @unique @db.VarChar(36)
user_id Int @db.UnsignedInt
name String @db.VarChar(100)
domain String? @db.VarChar(500)
share_id String? @unique @db.VarChar(64)
created_at DateTime? @default(now()) @db.Timestamp(0)
account account @relation(fields: [user_id], references: [user_id])
event event[]
pageview pageview[]
session session[]
@@index([user_id], name: "website_user_id_idx")
}