mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
134 lines
4.3 KiB
Plaintext
134 lines
4.3 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
relationMode = "prisma"
|
|
}
|
|
|
|
model User {
|
|
id String @id @unique @map("user_id") @db.Uuid
|
|
username String @unique @db.VarChar(255)
|
|
password String @db.VarChar(60)
|
|
role String @map("role") @db.VarChar(50)
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
updatedAt DateTime? @map("updated_at") @db.Timestamptz(6)
|
|
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
|
|
|
|
Website Website[]
|
|
teamUser TeamUser[]
|
|
teamWebsite TeamWebsite[]
|
|
|
|
@@map("user")
|
|
}
|
|
|
|
model Session {
|
|
id String @id @unique @map("session_id") @db.Uuid
|
|
websiteId String @map("website_id") @db.Uuid
|
|
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)
|
|
subdivision1 String? @db.Char(3)
|
|
subdivision2 String? @db.VarChar(50)
|
|
city String? @db.VarChar(50)
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
|
|
@@index([createdAt])
|
|
@@index([websiteId])
|
|
@@map("session")
|
|
}
|
|
|
|
model Website {
|
|
id String @id @unique @map("website_id") @db.Uuid
|
|
name String @db.VarChar(100)
|
|
domain String? @db.VarChar(500)
|
|
shareId String? @unique @map("share_id") @db.VarChar(50)
|
|
revId Int @default(0) @map("rev_id") @db.Integer
|
|
userId String? @map("user_id") @db.Uuid
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
updatedAt DateTime? @map("updated_at") @db.Timestamptz(6)
|
|
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
|
|
|
|
user User? @relation(fields: [userId], references: [id])
|
|
teamWebsite TeamWebsite[]
|
|
|
|
@@index([userId])
|
|
@@index([createdAt])
|
|
@@index([shareId])
|
|
@@map("website")
|
|
}
|
|
|
|
model WebsiteEvent {
|
|
id String @id() @map("event_id") @db.Uuid
|
|
websiteId String @map("website_id") @db.Uuid
|
|
sessionId String @map("session_id") @db.Uuid
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
url String @db.VarChar(500)
|
|
referrer String? @db.VarChar(500)
|
|
pageTitle String? @map("page_title") @db.VarChar(500)
|
|
eventType Int @default(1) @map("event_type") @db.Integer
|
|
eventName String? @map("event_name") @db.VarChar(50)
|
|
|
|
@@index([createdAt])
|
|
@@index([sessionId])
|
|
@@index([websiteId])
|
|
@@index([websiteId, createdAt])
|
|
@@index([websiteId, sessionId, createdAt])
|
|
@@map("website_event")
|
|
}
|
|
|
|
model Team {
|
|
id String @id() @unique() @map("team_id") @db.Uuid
|
|
name String @db.VarChar(50)
|
|
userId String @map("user_id") @db.Uuid
|
|
accessCode String? @unique @map("access_code") @db.VarChar(50)
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
updatedAt DateTime? @map("updated_at") @db.Timestamptz(6)
|
|
|
|
teamUser TeamUser[]
|
|
teamWebsite TeamWebsite[]
|
|
|
|
@@index([userId])
|
|
@@index([accessCode])
|
|
@@map("team")
|
|
}
|
|
|
|
model TeamUser {
|
|
id String @id() @unique() @map("team_user_id") @db.Uuid
|
|
teamId String @map("team_id") @db.Uuid
|
|
userId String @map("user_id") @db.Uuid
|
|
role String @map("role") @db.VarChar(50)
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
updatedAt DateTime? @map("updated_at") @db.Timestamptz(6)
|
|
|
|
team Team @relation(fields: [teamId], references: [id])
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
@@index([teamId])
|
|
@@index([userId])
|
|
@@map("team_user")
|
|
}
|
|
|
|
model TeamWebsite {
|
|
id String @id() @unique() @map("team_website_id") @db.Uuid
|
|
teamId String @map("team_id") @db.Uuid
|
|
userId String @map("user_id") @db.Uuid
|
|
websiteId String @map("website_id") @db.Uuid
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
|
|
team Team @relation(fields: [teamId], references: [id])
|
|
user User @relation(fields: [userId], references: [id])
|
|
website Website @relation(fields: [websiteId], references: [id])
|
|
|
|
@@index([teamId])
|
|
@@index([userId])
|
|
@@index([websiteId])
|
|
@@map("team_website")
|
|
}
|