mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-16 02:05:04 +01:00
88 lines
2.9 KiB
Plaintext
88 lines
2.9 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model account {
|
|
user_id Int @id @default(autoincrement())
|
|
username String @unique @db.VarChar(255)
|
|
password String @db.VarChar(60)
|
|
is_admin Boolean @default(false)
|
|
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
updated_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
website website[]
|
|
}
|
|
|
|
model event {
|
|
event_id Int @id @default(autoincrement())
|
|
website_id Int
|
|
session_id Int
|
|
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
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], onDelete: Cascade, onUpdate: NoAction)
|
|
website website @relation(fields: [website_id], references: [website_id], onDelete: Cascade, onUpdate: NoAction)
|
|
|
|
@@index([created_at])
|
|
@@index([session_id])
|
|
@@index([website_id])
|
|
}
|
|
|
|
model pageview {
|
|
view_id Int @id @default(autoincrement())
|
|
website_id Int
|
|
session_id Int
|
|
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
url String @db.VarChar(500)
|
|
referrer String? @db.VarChar(500)
|
|
session session @relation(fields: [session_id], references: [session_id], onDelete: Cascade, onUpdate: NoAction)
|
|
website website @relation(fields: [website_id], references: [website_id], onDelete: Cascade, onUpdate: NoAction)
|
|
|
|
@@index([created_at])
|
|
@@index([session_id])
|
|
@@index([website_id, created_at])
|
|
@@index([website_id])
|
|
@@index([website_id, session_id, created_at])
|
|
}
|
|
|
|
model session {
|
|
session_id Int @id @default(autoincrement())
|
|
session_uuid String @unique @db.Uuid
|
|
website_id Int
|
|
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
hostname String? @db.VarChar(100)
|
|
browser String? @db.VarChar(20)
|
|
os String? @db.VarChar(20)
|
|
screen String? @db.VarChar(11)
|
|
language String? @db.VarChar(35)
|
|
country String? @db.Char(2)
|
|
device String? @db.VarChar(20)
|
|
website website @relation(fields: [website_id], references: [website_id], onDelete: Cascade, onUpdate: NoAction)
|
|
event event[]
|
|
pageview pageview[]
|
|
|
|
@@index([created_at])
|
|
@@index([website_id])
|
|
}
|
|
|
|
model website {
|
|
website_id Int @id @default(autoincrement())
|
|
website_uuid String @unique @db.Uuid
|
|
name String @db.VarChar(100)
|
|
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
user_id Int
|
|
domain String? @db.VarChar(500)
|
|
share_id String? @unique(map: "website_share_id_idx") @db.VarChar(64)
|
|
account account @relation(fields: [user_id], references: [user_id], onDelete: NoAction, onUpdate: NoAction)
|
|
event event[]
|
|
pageview pageview[]
|
|
session session[]
|
|
|
|
@@index([user_id])
|
|
}
|