mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
198 lines
6.5 KiB
Plaintext
198 lines
6.5 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model user {
|
|
id String @id @unique @map("user_id") @db.Uuid
|
|
username String @unique @db.VarChar(255)
|
|
password String @db.VarChar(60)
|
|
isAdmin Boolean @default(false) @map("is_admin")
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
|
|
groupRole groupRole[]
|
|
groupUser groupUser[]
|
|
userRole userRole[]
|
|
teamWebsite teamWebsite[]
|
|
teamUser teamUser[]
|
|
userWebsite userWebsite[]
|
|
website website[]
|
|
}
|
|
|
|
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)
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
|
|
@@index([createdAt])
|
|
@@index([websiteId])
|
|
}
|
|
|
|
model website {
|
|
id String @id @unique @map("website_id") @db.Uuid
|
|
userId String @map("user_id") @db.Uuid
|
|
name String @db.VarChar(100)
|
|
domain String? @db.VarChar(500)
|
|
shareId String? @unique @map("share_id") @db.VarChar(64)
|
|
revId Int @default(0) @map("rev_id") @db.Integer
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
isDeleted Boolean @default(false) @map("is_deleted")
|
|
|
|
user user @relation(fields: [userId], references: [id])
|
|
teamWebsite teamWebsite[]
|
|
userWebsite userWebsite[]
|
|
|
|
@@index([userId])
|
|
@@index([createdAt])
|
|
@@index([shareId])
|
|
}
|
|
|
|
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)
|
|
eventName String @map("event_name") @db.VarChar(50)
|
|
eventData Json @map("event_data")
|
|
|
|
@@index([createdAt])
|
|
@@index([sessionId])
|
|
@@index([websiteId])
|
|
@@index([websiteId, createdAt])
|
|
@@index([websiteId, sessionId, createdAt])
|
|
}
|
|
|
|
model group {
|
|
id String @id() @unique() @map("group_id") @db.Uuid
|
|
name String @unique() @db.VarChar(255)
|
|
description String? @db.VarChar(255)
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
isDeleted Boolean @default(false) @map("is_deleted")
|
|
|
|
groupRoles groupRole[]
|
|
groupUsers groupUser[]
|
|
}
|
|
|
|
model groupRole {
|
|
id String @id() @unique() @map("group_role_id") @db.Uuid
|
|
groupId String @map("group_id") @db.Uuid
|
|
roleId String @map("role_id") @db.Uuid
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
isDeleted Boolean @default(false) @map("is_deleted")
|
|
|
|
group group @relation(fields: [groupId], references: [id])
|
|
role role @relation(fields: [roleId], references: [id])
|
|
user user? @relation(fields: [userId], references: [id])
|
|
userId String? @db.Uuid
|
|
|
|
@@map("group_role")
|
|
}
|
|
|
|
model groupUser {
|
|
id String @id() @unique() @map("group_user_id") @db.Uuid
|
|
groupId String @map("group_id") @db.Uuid
|
|
userId String @map("user_id") @db.Uuid
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
isDeleted Boolean @default(false) @map("is_deleted")
|
|
|
|
group group @relation(fields: [groupId], references: [id])
|
|
user user @relation(fields: [userId], references: [id])
|
|
|
|
@@map("group_user")
|
|
}
|
|
|
|
model permission {
|
|
id String @id() @unique() @map("permission_id") @db.Uuid
|
|
name String @unique() @db.VarChar(255)
|
|
description String? @db.VarChar(255)
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
isDeleted Boolean @default(false) @map("is_deleted")
|
|
}
|
|
|
|
model role {
|
|
id String @id() @unique() @map("role_id") @db.Uuid
|
|
name String @unique() @db.VarChar(255)
|
|
description String? @db.VarChar(255)
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
isDeleted Boolean @default(false) @map("is_deleted")
|
|
|
|
groupRoles groupRole[]
|
|
userRoles userRole[]
|
|
}
|
|
|
|
model userRole {
|
|
id String @id() @unique() @map("user_role_id") @db.Uuid
|
|
roleId String @map("role_id") @db.Uuid
|
|
userId String @map("user_id") @db.Uuid
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
isDeleted Boolean @default(false) @map("is_deleted")
|
|
|
|
role role @relation(fields: [roleId], references: [id])
|
|
user user @relation(fields: [userId], references: [id])
|
|
|
|
@@map("user_role")
|
|
}
|
|
|
|
model team {
|
|
id String @id() @unique() @map("team_id") @db.Uuid
|
|
name String @unique() @db.VarChar(50)
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
isDeleted Boolean @default(false) @map("is_deleted")
|
|
|
|
teamWebsites teamWebsite[]
|
|
teamUsers teamUser[]
|
|
}
|
|
|
|
model teamWebsite {
|
|
id String @id() @unique() @map("team_website_id") @db.Uuid
|
|
teamId String @map("team_id") @db.Uuid
|
|
websiteId String @map("website_id") @db.Uuid
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
isDeleted Boolean @default(false) @map("is_deleted")
|
|
|
|
website website @relation(fields: [websiteId], references: [id])
|
|
team team @relation(fields: [teamId], references: [id])
|
|
user user? @relation(fields: [userId], references: [id])
|
|
userId String? @db.Uuid
|
|
|
|
@@map("team_website")
|
|
}
|
|
|
|
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
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
isDeleted Boolean @default(false) @map("is_deleted")
|
|
|
|
team team @relation(fields: [teamId], references: [id])
|
|
user user @relation(fields: [userId], references: [id])
|
|
|
|
@@map("team_user")
|
|
}
|
|
|
|
model userWebsite {
|
|
id String @id() @unique() @map("user_website_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)
|
|
|
|
website website @relation(fields: [websiteId], references: [id])
|
|
user user @relation(fields: [userId], references: [id])
|
|
|
|
@@map("user_website")
|
|
}
|