2020-07-17 10:03:38 +02:00
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
|
|
|
datasource db {
|
2023-03-02 01:42:47 +01:00
|
|
|
provider = "postgresql"
|
|
|
|
url = env("DATABASE_URL")
|
2022-12-28 01:26:25 +01:00
|
|
|
relationMode = "prisma"
|
2020-07-17 10:03:38 +02:00
|
|
|
}
|
|
|
|
|
2022-11-10 20:08:40 +01:00
|
|
|
model User {
|
2022-11-01 07:42:37 +01:00
|
|
|
id String @id @unique @map("user_id") @db.Uuid
|
|
|
|
username String @unique @db.VarChar(255)
|
|
|
|
password String @db.VarChar(60)
|
2022-12-05 22:03:02 +01:00
|
|
|
role String @map("role") @db.VarChar(50)
|
2022-11-01 07:42:37 +01:00
|
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
2023-05-09 08:46:58 +02:00
|
|
|
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
2022-12-05 22:03:02 +01:00
|
|
|
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
|
2022-10-22 06:33:23 +02:00
|
|
|
|
2023-05-15 06:38:03 +02:00
|
|
|
website Website[]
|
|
|
|
teamUser TeamUser[]
|
2023-06-01 06:46:49 +02:00
|
|
|
report Report[]
|
2022-11-10 20:58:43 +01:00
|
|
|
|
|
|
|
@@map("user")
|
2020-07-23 05:45:09 +02:00
|
|
|
}
|
|
|
|
|
2022-11-10 20:08:40 +01:00
|
|
|
model Session {
|
2023-02-16 18:52:07 +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)
|
2023-04-17 06:07:36 +02:00
|
|
|
subdivision1 String? @db.VarChar(20)
|
2023-03-01 02:40:18 +01:00
|
|
|
subdivision2 String? @db.VarChar(50)
|
2023-02-16 18:52:07 +01:00
|
|
|
city String? @db.VarChar(50)
|
|
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
2020-07-18 04:33:40 +02:00
|
|
|
|
2023-03-23 07:02:37 +01:00
|
|
|
websiteEvent WebsiteEvent[]
|
2023-06-01 06:46:49 +02:00
|
|
|
sessionData SessionData[]
|
2023-03-23 07:02:37 +01:00
|
|
|
|
2022-10-10 22:42:18 +02:00
|
|
|
@@index([createdAt])
|
|
|
|
@@index([websiteId])
|
2022-11-10 20:58:43 +01:00
|
|
|
@@map("session")
|
2020-07-17 10:03:38 +02:00
|
|
|
}
|
|
|
|
|
2022-11-10 20:08:40 +01:00
|
|
|
model Website {
|
2022-11-01 07:42:37 +01:00
|
|
|
id String @id @unique @map("website_id") @db.Uuid
|
|
|
|
name String @db.VarChar(100)
|
|
|
|
domain String? @db.VarChar(500)
|
2022-12-27 09:00:31 +01:00
|
|
|
shareId String? @unique @map("share_id") @db.VarChar(50)
|
2023-03-27 20:25:16 +02:00
|
|
|
resetAt DateTime? @map("reset_at") @db.Timestamptz(6)
|
2022-11-20 09:48:13 +01:00
|
|
|
userId String? @map("user_id") @db.Uuid
|
2022-11-01 07:42:37 +01:00
|
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
2023-05-09 08:46:58 +02:00
|
|
|
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
2022-12-05 22:03:02 +01:00
|
|
|
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
|
2022-11-01 07:42:37 +01:00
|
|
|
|
2023-03-02 01:42:47 +01:00
|
|
|
user User? @relation(fields: [userId], references: [id])
|
2023-02-02 02:08:16 +01:00
|
|
|
teamWebsite TeamWebsite[]
|
2023-03-23 07:02:37 +01:00
|
|
|
eventData EventData[]
|
2023-06-01 06:46:49 +02:00
|
|
|
report Report[]
|
|
|
|
sessionData SessionData[]
|
2020-08-12 09:23:03 +02:00
|
|
|
|
2022-12-28 01:26:25 +01:00
|
|
|
@@index([userId])
|
2022-11-05 00:15:26 +01:00
|
|
|
@@index([createdAt])
|
|
|
|
@@index([shareId])
|
2022-11-10 20:58:43 +01:00
|
|
|
@@map("website")
|
2022-11-05 00:15:26 +01:00
|
|
|
}
|
|
|
|
|
2022-11-10 20:08:40 +01:00
|
|
|
model WebsiteEvent {
|
2023-03-15 01:27:17 +01:00
|
|
|
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)
|
|
|
|
urlPath String @map("url_path") @db.VarChar(500)
|
|
|
|
urlQuery String? @map("url_query") @db.VarChar(500)
|
|
|
|
referrerPath String? @map("referrer_path") @db.VarChar(500)
|
|
|
|
referrerQuery String? @map("referrer_query") @db.VarChar(500)
|
|
|
|
referrerDomain String? @map("referrer_domain") @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)
|
2022-11-05 00:15:26 +01:00
|
|
|
|
2023-03-23 07:02:37 +01:00
|
|
|
eventData EventData[]
|
|
|
|
session Session @relation(fields: [sessionId], references: [id])
|
|
|
|
|
2022-11-05 00:15:26 +01:00
|
|
|
@@index([createdAt])
|
|
|
|
@@index([sessionId])
|
|
|
|
@@index([websiteId])
|
|
|
|
@@index([websiteId, createdAt])
|
|
|
|
@@index([websiteId, sessionId, createdAt])
|
2022-11-10 20:08:40 +01:00
|
|
|
@@map("website_event")
|
2022-11-01 07:42:37 +01:00
|
|
|
}
|
|
|
|
|
2023-03-23 07:02:37 +01:00
|
|
|
model EventData {
|
2023-06-01 06:46:49 +02:00
|
|
|
id String @id() @map("event_data_id") @db.Uuid
|
|
|
|
websiteId String @map("website_id") @db.Uuid
|
|
|
|
websiteEventId String @map("website_event_id") @db.Uuid
|
|
|
|
eventKey String @map("event_key") @db.VarChar(500)
|
|
|
|
stringValue String? @map("string_value") @db.VarChar(500)
|
|
|
|
numericValue Decimal? @map("numeric_value") @db.Decimal(19, 4)
|
|
|
|
dateValue DateTime? @map("date_value") @db.Timestamptz(6)
|
|
|
|
dataType Int @map("data_type") @db.Integer
|
|
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
2023-03-23 07:02:37 +01:00
|
|
|
|
|
|
|
website Website @relation(fields: [websiteId], references: [id])
|
|
|
|
websiteEvent WebsiteEvent @relation(fields: [websiteEventId], references: [id])
|
|
|
|
|
|
|
|
@@index([createdAt])
|
|
|
|
@@index([websiteId])
|
|
|
|
@@index([websiteEventId])
|
|
|
|
@@map("event_data")
|
|
|
|
}
|
|
|
|
|
2023-06-01 06:46:49 +02:00
|
|
|
model SessionData {
|
|
|
|
id String @id() @map("session_data_id") @db.Uuid
|
|
|
|
websiteId String @map("website_id") @db.Uuid
|
|
|
|
sessionId String @map("session_id") @db.Uuid
|
|
|
|
sessionKey String @map("session_key") @db.VarChar(500)
|
|
|
|
stringValue String? @map("string_value") @db.VarChar(500)
|
|
|
|
numericValue Decimal? @map("numeric_value") @db.Decimal(19, 4)
|
|
|
|
dateValue DateTime? @map("date_value") @db.Timestamptz(6)
|
|
|
|
dataType Int @map("data_type") @db.Integer
|
|
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
|
|
deletedAt DateTime? @default(now()) @map("deleted_at") @db.Timestamptz(6)
|
|
|
|
|
|
|
|
website Website @relation(fields: [websiteId], references: [id])
|
|
|
|
session Session @relation(fields: [sessionId], references: [id])
|
|
|
|
|
|
|
|
@@index([createdAt])
|
|
|
|
@@index([websiteId])
|
|
|
|
@@index([sessionId])
|
|
|
|
@@map("session_data")
|
|
|
|
}
|
|
|
|
|
2022-11-10 20:08:40 +01:00
|
|
|
model Team {
|
2022-12-27 09:00:31 +01:00
|
|
|
id String @id() @unique() @map("team_id") @db.Uuid
|
|
|
|
name String @db.VarChar(50)
|
|
|
|
accessCode String? @unique @map("access_code") @db.VarChar(50)
|
|
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
2023-05-09 08:46:58 +02:00
|
|
|
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
2022-11-01 07:42:37 +01:00
|
|
|
|
2023-03-02 01:42:47 +01:00
|
|
|
teamUser TeamUser[]
|
2023-02-02 02:08:16 +01:00
|
|
|
teamWebsite TeamWebsite[]
|
2022-11-10 20:58:43 +01:00
|
|
|
|
2022-12-27 09:00:31 +01:00
|
|
|
@@index([accessCode])
|
2022-11-10 20:58:43 +01:00
|
|
|
@@map("team")
|
2022-11-01 07:42:37 +01:00
|
|
|
}
|
|
|
|
|
2022-11-10 20:08:40 +01:00
|
|
|
model TeamUser {
|
2022-11-01 07:42:37 +01:00
|
|
|
id String @id() @unique() @map("team_user_id") @db.Uuid
|
|
|
|
teamId String @map("team_id") @db.Uuid
|
|
|
|
userId String @map("user_id") @db.Uuid
|
2022-12-05 22:03:02 +01:00
|
|
|
role String @map("role") @db.VarChar(50)
|
2022-11-01 07:42:37 +01:00
|
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
2023-05-09 08:46:58 +02:00
|
|
|
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
2022-11-01 07:42:37 +01:00
|
|
|
|
2022-11-10 20:08:40 +01:00
|
|
|
team Team @relation(fields: [teamId], references: [id])
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
2022-11-01 07:42:37 +01:00
|
|
|
|
2022-12-27 09:00:31 +01:00
|
|
|
@@index([teamId])
|
|
|
|
@@index([userId])
|
2022-11-01 07:42:37 +01:00
|
|
|
@@map("team_user")
|
|
|
|
}
|
2023-02-02 02:08:16 +01:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
2023-03-02 01:42:47 +01:00
|
|
|
team Team @relation(fields: [teamId], references: [id])
|
2023-02-02 02:08:16 +01:00
|
|
|
website Website @relation(fields: [websiteId], references: [id])
|
|
|
|
|
|
|
|
@@index([teamId])
|
|
|
|
@@index([websiteId])
|
|
|
|
@@map("team_website")
|
2023-03-23 22:01:15 +01:00
|
|
|
}
|
2023-05-09 08:46:58 +02:00
|
|
|
|
2023-05-15 06:38:03 +02:00
|
|
|
model Report {
|
|
|
|
id String @id() @unique() @map("report_id") @db.Uuid
|
|
|
|
userId String @map("user_id") @db.Uuid
|
|
|
|
websiteId String @map("website_id") @db.Uuid
|
|
|
|
type String @map("type") @db.VarChar(200)
|
|
|
|
name String @map("name") @db.VarChar(200)
|
|
|
|
description String @map("description") @db.VarChar(500)
|
|
|
|
parameters String @map("parameters") @db.VarChar(6000)
|
|
|
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
|
|
|
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
|
|
|
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
website Website @relation(fields: [websiteId], references: [id])
|
2023-05-09 08:46:58 +02:00
|
|
|
|
|
|
|
@@index([userId])
|
2023-05-15 06:38:03 +02:00
|
|
|
@@index([websiteId])
|
2023-05-27 22:29:09 +02:00
|
|
|
@@index([type])
|
|
|
|
@@index([name])
|
2023-05-15 06:38:03 +02:00
|
|
|
@@map("report")
|
2023-05-09 08:46:58 +02:00
|
|
|
}
|