2020-07-17 10:03:38 +02:00
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
|
|
|
datasource db {
|
|
|
|
provider = "postgresql"
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
|
|
|
|
2022-11-01 07:42:37 +01:00
|
|
|
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)
|
2022-10-22 06:33:23 +02:00
|
|
|
|
2022-11-01 07:42:37 +01:00
|
|
|
groupRole groupRole[]
|
|
|
|
groupUser groupUser[]
|
|
|
|
userRole userRole[]
|
|
|
|
teamWebsite teamWebsite[]
|
|
|
|
teamUser teamUser[]
|
|
|
|
userWebsite userWebsite[]
|
|
|
|
website website[]
|
2020-07-23 05:45:09 +02:00
|
|
|
}
|
|
|
|
|
2020-07-17 10:03:38 +02:00
|
|
|
model session {
|
2022-11-01 07:42:37 +01:00
|
|
|
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)
|
2020-07-18 04:33:40 +02:00
|
|
|
|
2022-10-10 22:42:18 +02:00
|
|
|
@@index([createdAt])
|
|
|
|
@@index([websiteId])
|
2020-07-17 10:03:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
model website {
|
2022-11-01 07:42:37 +01:00
|
|
|
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)
|
2022-11-05 00:15:26 +01:00
|
|
|
revId Int @default(0) @map("rev_id") @db.Int
|
2022-11-01 07:42:37 +01:00
|
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
2022-11-05 00:15:26 +01:00
|
|
|
isDeleted Boolean @default(false) @map("is_deleted")
|
2022-11-01 07:42:37 +01:00
|
|
|
|
|
|
|
user user @relation(fields: [userId], references: [id])
|
|
|
|
teamWebsite teamWebsite[]
|
|
|
|
userWebsite userWebsite[]
|
2020-08-12 09:23:03 +02:00
|
|
|
|
2022-10-10 22:42:18 +02:00
|
|
|
@@index([userId])
|
2022-11-05 00:15:26 +01:00
|
|
|
@@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])
|
2022-11-01 07:42:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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")
|
2022-07-15 07:57:38 +02:00
|
|
|
}
|