fix(2FA): cascade delete on 2FA tables linked to the user
This commit is contained in:
1 parent
5c5d1c3524
commit
fc8d34f2e1
1 file changed
+143
-155
+143
-155
@@ -10,44 +10,44 @@ datasource db {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model User {
|
model User {
|
||||||
id String @id() @map("user_id") @db.Uuid
|
id String @id @map("user_id") @db.Uuid
|
||||||
username String @unique @db.VarChar(255)
|
username String @unique @db.VarChar(255)
|
||||||
password String @db.VarChar(60)
|
password String @db.VarChar(60)
|
||||||
role String @map("role") @db.VarChar(50)
|
role String @map("role") @db.VarChar(50)
|
||||||
logoUrl String? @map("logo_url") @db.VarChar(2183)
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
displayName String? @map("display_name") @db.VarChar(255)
|
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
|
||||||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
displayName String? @map("display_name") @db.VarChar(255)
|
||||||
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
|
logoUrl String? @map("logo_url") @db.VarChar(2183)
|
||||||
twoFactorRequired Boolean @default(false) @map("two_factor_required")
|
twoFactorRequired Boolean @default(false) @map("two_factor_required")
|
||||||
|
websites Website[] @relation("user")
|
||||||
websites Website[] @relation("user")
|
createdBy Website[] @relation("createUser")
|
||||||
createdBy Website[] @relation("createUser")
|
links Link[] @relation("user")
|
||||||
links Link[] @relation("user")
|
pixels Pixel[] @relation("user")
|
||||||
pixels Pixel[] @relation("user")
|
|
||||||
teams TeamUser[]
|
teams TeamUser[]
|
||||||
reports Report[]
|
reports Report[]
|
||||||
boards Board[] @relation("user")
|
boards Board[] @relation("user")
|
||||||
twoFactorAuth TwoFactorAuth?
|
twoFactorAuth TwoFactorAuth?
|
||||||
twoFactorBackupCodes TwoFactorBackupCode[]
|
twoFactorBackupCodes TwoFactorBackupCode[]
|
||||||
|
twoFactorOtpUsed TwoFactorOtpUsed[]
|
||||||
|
twoFactorRateLimit TwoFactorRateLimit?
|
||||||
|
|
||||||
@@map("user")
|
@@map("user")
|
||||||
}
|
}
|
||||||
|
|
||||||
model Session {
|
model Session {
|
||||||
id String @id() @map("session_id") @db.Uuid
|
id String @id @map("session_id") @db.Uuid
|
||||||
websiteId String @map("website_id") @db.Uuid
|
websiteId String @map("website_id") @db.Uuid
|
||||||
browser String? @db.VarChar(20)
|
browser String? @db.VarChar(20)
|
||||||
os String? @db.VarChar(20)
|
os String? @db.VarChar(20)
|
||||||
device String? @db.VarChar(20)
|
device String? @db.VarChar(20)
|
||||||
screen String? @db.VarChar(11)
|
screen String? @db.VarChar(11)
|
||||||
language String? @db.VarChar(35)
|
language String? @db.VarChar(35)
|
||||||
country String? @db.Char(2)
|
country String? @db.Char(2)
|
||||||
region String? @db.VarChar(20)
|
region String? @db.VarChar(20)
|
||||||
city String? @db.VarChar(50)
|
city String? @db.VarChar(50)
|
||||||
distinctId String? @map("distinct_id") @db.VarChar(50)
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
distinctId String? @map("distinct_id") @db.VarChar(50)
|
||||||
|
|
||||||
websiteEvents WebsiteEvent[]
|
websiteEvents WebsiteEvent[]
|
||||||
sessionData SessionData[]
|
sessionData SessionData[]
|
||||||
revenue Revenue[]
|
revenue Revenue[]
|
||||||
@@ -67,23 +67,21 @@ model Session {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Website {
|
model Website {
|
||||||
id String @id() @map("website_id") @db.Uuid
|
id String @id @map("website_id") @db.Uuid
|
||||||
name String @db.VarChar(100)
|
name String @db.VarChar(100)
|
||||||
domain String? @db.VarChar(500)
|
domain String? @db.VarChar(500)
|
||||||
resetAt DateTime? @map("reset_at") @db.Timestamptz(6)
|
resetAt DateTime? @map("reset_at") @db.Timestamptz(6)
|
||||||
userId String? @map("user_id") @db.Uuid
|
userId String? @map("user_id") @db.Uuid
|
||||||
teamId String? @map("team_id") @db.Uuid
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
createdBy String? @map("created_by") @db.Uuid
|
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
|
||||||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
createdBy String? @map("created_by") @db.Uuid
|
||||||
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
|
teamId String? @map("team_id") @db.Uuid
|
||||||
|
replayEnabled Boolean @default(false) @map("replay_enabled")
|
||||||
replayEnabled Boolean @default(false) @map("replay_enabled")
|
replayConfig Json? @map("replay_config")
|
||||||
replayConfig Json? @map("replay_config")
|
user User? @relation("user", fields: [userId], references: [id])
|
||||||
|
createUser User? @relation("createUser", fields: [createdBy], references: [id])
|
||||||
user User? @relation("user", fields: [userId], references: [id])
|
team Team? @relation(fields: [teamId], references: [id])
|
||||||
createUser User? @relation("createUser", fields: [createdBy], references: [id])
|
|
||||||
team Team? @relation(fields: [teamId], references: [id])
|
|
||||||
eventData EventData[]
|
eventData EventData[]
|
||||||
reports Report[]
|
reports Report[]
|
||||||
revenue Revenue[]
|
revenue Revenue[]
|
||||||
@@ -100,40 +98,39 @@ model Website {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model WebsiteEvent {
|
model WebsiteEvent {
|
||||||
id String @id() @map("event_id") @db.Uuid
|
id String @id @map("event_id") @db.Uuid
|
||||||
websiteId String @map("website_id") @db.Uuid
|
websiteId String @map("website_id") @db.Uuid
|
||||||
sessionId String @map("session_id") @db.Uuid
|
sessionId String @map("session_id") @db.Uuid
|
||||||
visitId String @map("visit_id") @db.Uuid
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
urlPath String @map("url_path") @db.VarChar(500)
|
||||||
urlPath String @map("url_path") @db.VarChar(500)
|
urlQuery String? @map("url_query") @db.VarChar(500)
|
||||||
urlQuery String? @map("url_query") @db.VarChar(500)
|
referrerPath String? @map("referrer_path") @db.VarChar(500)
|
||||||
utmSource String? @map("utm_source") @db.VarChar(255)
|
referrerQuery String? @map("referrer_query") @db.VarChar(500)
|
||||||
utmMedium String? @map("utm_medium") @db.VarChar(255)
|
referrerDomain String? @map("referrer_domain") @db.VarChar(500)
|
||||||
utmCampaign String? @map("utm_campaign") @db.VarChar(255)
|
pageTitle String? @map("page_title") @db.VarChar(500)
|
||||||
utmContent String? @map("utm_content") @db.VarChar(255)
|
eventType Int @default(1) @map("event_type")
|
||||||
utmTerm String? @map("utm_term") @db.VarChar(255)
|
eventName String? @map("event_name") @db.VarChar(50)
|
||||||
referrerPath String? @map("referrer_path") @db.VarChar(500)
|
visitId String @map("visit_id") @db.Uuid
|
||||||
referrerQuery String? @map("referrer_query") @db.VarChar(500)
|
tag String? @db.VarChar(50)
|
||||||
referrerDomain String? @map("referrer_domain") @db.VarChar(500)
|
fbclid String? @db.VarChar(255)
|
||||||
pageTitle String? @map("page_title") @db.VarChar(500)
|
gclid String? @db.VarChar(255)
|
||||||
gclid String? @db.VarChar(255)
|
lifatid String? @map("li_fat_id") @db.VarChar(255)
|
||||||
fbclid String? @db.VarChar(255)
|
msclkid String? @db.VarChar(255)
|
||||||
msclkid String? @db.VarChar(255)
|
ttclid String? @db.VarChar(255)
|
||||||
ttclid String? @db.VarChar(255)
|
twclid String? @db.VarChar(255)
|
||||||
lifatid String? @map("li_fat_id") @db.VarChar(255)
|
utmCampaign String? @map("utm_campaign") @db.VarChar(255)
|
||||||
twclid String? @db.VarChar(255)
|
utmContent String? @map("utm_content") @db.VarChar(255)
|
||||||
eventType Int @default(1) @map("event_type") @db.Integer
|
utmMedium String? @map("utm_medium") @db.VarChar(255)
|
||||||
eventName String? @map("event_name") @db.VarChar(50)
|
utmSource String? @map("utm_source") @db.VarChar(255)
|
||||||
tag String? @db.VarChar(50)
|
utmTerm String? @map("utm_term") @db.VarChar(255)
|
||||||
hostname String? @db.VarChar(100)
|
hostname String? @db.VarChar(100)
|
||||||
lcp Decimal? @db.Decimal(10, 1)
|
cls Decimal? @db.Decimal(10, 4)
|
||||||
inp Decimal? @db.Decimal(10, 1)
|
fcp Decimal? @db.Decimal(10, 1)
|
||||||
cls Decimal? @db.Decimal(10, 4)
|
inp Decimal? @db.Decimal(10, 1)
|
||||||
fcp Decimal? @db.Decimal(10, 1)
|
lcp Decimal? @db.Decimal(10, 1)
|
||||||
ttfb Decimal? @db.Decimal(10, 1)
|
ttfb Decimal? @db.Decimal(10, 1)
|
||||||
|
eventData EventData[]
|
||||||
eventData EventData[]
|
session Session @relation(fields: [sessionId], references: [id])
|
||||||
session Session @relation(fields: [sessionId], references: [id])
|
|
||||||
|
|
||||||
@@index([createdAt])
|
@@index([createdAt])
|
||||||
@@index([sessionId])
|
@@index([sessionId])
|
||||||
@@ -153,18 +150,17 @@ model WebsiteEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model EventData {
|
model EventData {
|
||||||
id String @id() @map("event_data_id") @db.Uuid
|
id String @id @map("event_data_id") @db.Uuid
|
||||||
websiteId String @map("website_id") @db.Uuid
|
websiteId String @map("website_id") @db.Uuid
|
||||||
websiteEventId String @map("website_event_id") @db.Uuid
|
websiteEventId String @map("website_event_id") @db.Uuid
|
||||||
dataKey String @map("data_key") @db.VarChar(500)
|
dataKey String @map("data_key") @db.VarChar(500)
|
||||||
stringValue String? @map("string_value") @db.VarChar(500)
|
stringValue String? @map("string_value") @db.VarChar(500)
|
||||||
numberValue Decimal? @map("number_value") @db.Decimal(19, 4)
|
numberValue Decimal? @map("number_value") @db.Decimal(19, 4)
|
||||||
dateValue DateTime? @map("date_value") @db.Timestamptz(6)
|
dateValue DateTime? @map("date_value") @db.Timestamptz(6)
|
||||||
dataType Int @map("data_type") @db.Integer
|
dataType Int @map("data_type")
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
|
website Website @relation(fields: [websiteId], references: [id])
|
||||||
website Website @relation(fields: [websiteId], references: [id])
|
websiteEvent WebsiteEvent @relation(fields: [websiteEventId], references: [id])
|
||||||
websiteEvent WebsiteEvent @relation(fields: [websiteEventId], references: [id])
|
|
||||||
|
|
||||||
@@index([createdAt])
|
@@index([createdAt])
|
||||||
@@index([websiteId])
|
@@index([websiteId])
|
||||||
@@ -175,19 +171,18 @@ model EventData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model SessionData {
|
model SessionData {
|
||||||
id String @id() @map("session_data_id") @db.Uuid
|
id String @id @map("session_data_id") @db.Uuid
|
||||||
websiteId String @map("website_id") @db.Uuid
|
websiteId String @map("website_id") @db.Uuid
|
||||||
sessionId String @map("session_id") @db.Uuid
|
sessionId String @map("session_id") @db.Uuid
|
||||||
dataKey String @map("data_key") @db.VarChar(500)
|
dataKey String @map("data_key") @db.VarChar(500)
|
||||||
stringValue String? @map("string_value") @db.VarChar(500)
|
stringValue String? @map("string_value") @db.VarChar(500)
|
||||||
numberValue Decimal? @map("number_value") @db.Decimal(19, 4)
|
numberValue Decimal? @map("number_value") @db.Decimal(19, 4)
|
||||||
dateValue DateTime? @map("date_value") @db.Timestamptz(6)
|
dateValue DateTime? @map("date_value") @db.Timestamptz(6)
|
||||||
dataType Int @map("data_type") @db.Integer
|
dataType Int @map("data_type")
|
||||||
distinctId String? @map("distinct_id") @db.VarChar(50)
|
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
|
distinctId String? @map("distinct_id") @db.VarChar(50)
|
||||||
website Website @relation(fields: [websiteId], references: [id])
|
website Website @relation(fields: [websiteId], references: [id])
|
||||||
session Session @relation(fields: [sessionId], references: [id])
|
session Session @relation(fields: [sessionId], references: [id])
|
||||||
|
|
||||||
@@index([createdAt])
|
@@index([createdAt])
|
||||||
@@index([websiteId])
|
@@index([websiteId])
|
||||||
@@ -198,35 +193,33 @@ model SessionData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Team {
|
model Team {
|
||||||
id String @id() @map("team_id") @db.Uuid
|
id String @id @map("team_id") @db.Uuid
|
||||||
name String @db.VarChar(50)
|
name String @db.VarChar(50)
|
||||||
accessCode String? @unique @map("access_code") @db.VarChar(50)
|
accessCode String? @unique @map("access_code") @db.VarChar(50)
|
||||||
logoUrl String? @map("logo_url") @db.VarChar(2183)
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
||||||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
|
||||||
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
|
logoUrl String? @map("logo_url") @db.VarChar(2183)
|
||||||
twoFactorRequired Boolean @default(false) @map("two_factor_required")
|
twoFactorRequired Boolean @default(false) @map("two_factor_required")
|
||||||
|
websites Website[]
|
||||||
websites Website[]
|
members TeamUser[]
|
||||||
members TeamUser[]
|
links Link[]
|
||||||
links Link[]
|
pixels Pixel[]
|
||||||
pixels Pixel[]
|
boards Board[]
|
||||||
boards Board[]
|
|
||||||
|
|
||||||
@@index([accessCode])
|
@@index([accessCode])
|
||||||
@@map("team")
|
@@map("team")
|
||||||
}
|
}
|
||||||
|
|
||||||
model TeamUser {
|
model TeamUser {
|
||||||
id String @id() @map("team_user_id") @db.Uuid
|
id String @id @map("team_user_id") @db.Uuid
|
||||||
teamId String @map("team_id") @db.Uuid
|
teamId String @map("team_id") @db.Uuid
|
||||||
userId String @map("user_id") @db.Uuid
|
userId String @map("user_id") @db.Uuid
|
||||||
role String @db.VarChar(50)
|
role String @db.VarChar(50)
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
||||||
|
team Team @relation(fields: [teamId], references: [id])
|
||||||
team Team @relation(fields: [teamId], references: [id])
|
user User @relation(fields: [userId], references: [id])
|
||||||
user User @relation(fields: [userId], references: [id])
|
|
||||||
|
|
||||||
@@index([teamId])
|
@@index([teamId])
|
||||||
@@index([userId])
|
@@index([userId])
|
||||||
@@ -234,7 +227,7 @@ model TeamUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Report {
|
model Report {
|
||||||
id String @id() @map("report_id") @db.Uuid
|
id String @id @map("report_id") @db.Uuid
|
||||||
userId String @map("user_id") @db.Uuid
|
userId String @map("user_id") @db.Uuid
|
||||||
websiteId String @map("website_id") @db.Uuid
|
websiteId String @map("website_id") @db.Uuid
|
||||||
type String @db.VarChar(50)
|
type String @db.VarChar(50)
|
||||||
@@ -243,9 +236,8 @@ model Report {
|
|||||||
parameters Json
|
parameters Json
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
||||||
|
user User @relation(fields: [userId], references: [id])
|
||||||
user User @relation(fields: [userId], references: [id])
|
website Website @relation(fields: [websiteId], references: [id])
|
||||||
website Website @relation(fields: [websiteId], references: [id])
|
|
||||||
|
|
||||||
@@index([userId])
|
@@index([userId])
|
||||||
@@index([websiteId])
|
@@index([websiteId])
|
||||||
@@ -255,22 +247,21 @@ model Report {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Segment {
|
model Segment {
|
||||||
id String @id() @map("segment_id") @db.Uuid
|
id String @id @map("segment_id") @db.Uuid
|
||||||
websiteId String @map("website_id") @db.Uuid
|
websiteId String @map("website_id") @db.Uuid
|
||||||
type String @db.VarChar(50)
|
type String @db.VarChar(50)
|
||||||
name String @db.VarChar(200)
|
name String @db.VarChar(200)
|
||||||
parameters Json
|
parameters Json
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
||||||
|
website Website @relation(fields: [websiteId], references: [id])
|
||||||
website Website @relation(fields: [websiteId], references: [id])
|
|
||||||
|
|
||||||
@@index([websiteId])
|
@@index([websiteId])
|
||||||
@@map("segment")
|
@@map("segment")
|
||||||
}
|
}
|
||||||
|
|
||||||
model Revenue {
|
model Revenue {
|
||||||
id String @id() @map("revenue_id") @db.Uuid
|
id String @id @map("revenue_id") @db.Uuid
|
||||||
websiteId String @map("website_id") @db.Uuid
|
websiteId String @map("website_id") @db.Uuid
|
||||||
sessionId String @map("session_id") @db.Uuid
|
sessionId String @map("session_id") @db.Uuid
|
||||||
eventId String @map("event_id") @db.Uuid
|
eventId String @map("event_id") @db.Uuid
|
||||||
@@ -278,9 +269,8 @@ model Revenue {
|
|||||||
currency String @db.VarChar(10)
|
currency String @db.VarChar(10)
|
||||||
revenue Decimal? @db.Decimal(19, 4)
|
revenue Decimal? @db.Decimal(19, 4)
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
|
website Website @relation(fields: [websiteId], references: [id])
|
||||||
website Website @relation(fields: [websiteId], references: [id])
|
session Session @relation(fields: [sessionId], references: [id])
|
||||||
session Session @relation(fields: [sessionId], references: [id])
|
|
||||||
|
|
||||||
@@index([websiteId])
|
@@index([websiteId])
|
||||||
@@index([sessionId])
|
@@index([sessionId])
|
||||||
@@ -290,18 +280,17 @@ model Revenue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Link {
|
model Link {
|
||||||
id String @id() @map("link_id") @db.Uuid
|
id String @id @map("link_id") @db.Uuid
|
||||||
name String @db.VarChar(100)
|
name String @db.VarChar(100)
|
||||||
url String @db.VarChar(500)
|
url String @db.VarChar(500)
|
||||||
slug String @unique() @db.VarChar(100)
|
slug String @unique @db.VarChar(100)
|
||||||
userId String? @map("user_id") @db.Uuid
|
userId String? @map("user_id") @db.Uuid
|
||||||
teamId String? @map("team_id") @db.Uuid
|
teamId String? @map("team_id") @db.Uuid
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
||||||
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
|
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
|
||||||
|
user User? @relation("user", fields: [userId], references: [id])
|
||||||
user User? @relation("user", fields: [userId], references: [id])
|
team Team? @relation(fields: [teamId], references: [id])
|
||||||
team Team? @relation(fields: [teamId], references: [id])
|
|
||||||
|
|
||||||
@@index([slug])
|
@@index([slug])
|
||||||
@@index([userId])
|
@@index([userId])
|
||||||
@@ -311,17 +300,16 @@ model Link {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Pixel {
|
model Pixel {
|
||||||
id String @id() @map("pixel_id") @db.Uuid
|
id String @id @map("pixel_id") @db.Uuid
|
||||||
name String @db.VarChar(100)
|
name String @db.VarChar(100)
|
||||||
slug String @unique() @db.VarChar(100)
|
slug String @unique @db.VarChar(100)
|
||||||
userId String? @map("user_id") @db.Uuid
|
userId String? @map("user_id") @db.Uuid
|
||||||
teamId String? @map("team_id") @db.Uuid
|
teamId String? @map("team_id") @db.Uuid
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
||||||
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
|
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
|
||||||
|
user User? @relation("user", fields: [userId], references: [id])
|
||||||
user User? @relation("user", fields: [userId], references: [id])
|
team Team? @relation(fields: [teamId], references: [id])
|
||||||
team Team? @relation(fields: [teamId], references: [id])
|
|
||||||
|
|
||||||
@@index([slug])
|
@@index([slug])
|
||||||
@@index([userId])
|
@@index([userId])
|
||||||
@@ -331,7 +319,7 @@ model Pixel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Board {
|
model Board {
|
||||||
id String @id() @map("board_id") @db.Uuid
|
id String @id @map("board_id") @db.Uuid
|
||||||
type String @db.VarChar(50)
|
type String @db.VarChar(50)
|
||||||
name String @db.VarChar(200)
|
name String @db.VarChar(200)
|
||||||
description String @db.VarChar(500)
|
description String @db.VarChar(500)
|
||||||
@@ -340,21 +328,21 @@ model Board {
|
|||||||
teamId String? @map("team_id") @db.Uuid
|
teamId String? @map("team_id") @db.Uuid
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
||||||
|
user User? @relation("user", fields: [userId], references: [id])
|
||||||
user User? @relation("user", fields: [userId], references: [id])
|
team Team? @relation(fields: [teamId], references: [id])
|
||||||
team Team? @relation(fields: [teamId], references: [id])
|
|
||||||
|
|
||||||
@@index([userId])
|
@@index([userId])
|
||||||
@@index([teamId])
|
@@index([teamId])
|
||||||
@@index([createdAt])
|
@@index([createdAt])
|
||||||
@@map("board")
|
@@map("board")
|
||||||
}
|
}
|
||||||
|
|
||||||
model Share {
|
model Share {
|
||||||
id String @id() @map("share_id") @db.Uuid
|
id String @id @map("share_id") @db.Uuid
|
||||||
entityId String @map("entity_id") @db.Uuid
|
entityId String @map("entity_id") @db.Uuid
|
||||||
name String @db.VarChar(200)
|
name String @db.VarChar(200)
|
||||||
shareType Int @map("share_type") @db.Integer
|
shareType Int @map("share_type")
|
||||||
slug String @unique() @db.VarChar(100)
|
slug String @unique @db.VarChar(100)
|
||||||
parameters Json
|
parameters Json
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
||||||
@@ -364,18 +352,17 @@ model Share {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model SessionReplay {
|
model SessionReplay {
|
||||||
id String @id() @map("replay_id") @db.Uuid
|
id String @id @map("replay_id") @db.Uuid
|
||||||
websiteId String @map("website_id") @db.Uuid
|
websiteId String @map("website_id") @db.Uuid
|
||||||
sessionId String @map("session_id") @db.Uuid
|
sessionId String @map("session_id") @db.Uuid
|
||||||
visitId String @map("visit_id") @db.Uuid
|
visitId String @map("visit_id") @db.Uuid
|
||||||
chunkIndex Int @map("chunk_index") @db.Integer
|
chunkIndex Int @map("chunk_index")
|
||||||
events Bytes @map("events")
|
events Bytes @map("events")
|
||||||
eventCount Int @map("event_count") @db.Integer
|
eventCount Int @map("event_count")
|
||||||
startedAt DateTime @map("started_at") @db.Timestamptz(6)
|
startedAt DateTime @map("started_at") @db.Timestamptz(6)
|
||||||
endedAt DateTime @map("ended_at") @db.Timestamptz(6)
|
endedAt DateTime @map("ended_at") @db.Timestamptz(6)
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
|
website Website @relation(fields: [websiteId], references: [id])
|
||||||
website Website @relation(fields: [websiteId], references: [id])
|
|
||||||
|
|
||||||
@@index([websiteId])
|
@@index([websiteId])
|
||||||
@@index([sessionId])
|
@@index([sessionId])
|
||||||
@@ -388,14 +375,13 @@ model SessionReplay {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model SessionReplaySaved {
|
model SessionReplaySaved {
|
||||||
id String @id() @map("saved_replay_id") @db.Uuid
|
id String @id @map("saved_replay_id") @db.Uuid
|
||||||
name String @db.VarChar(100)
|
name String @db.VarChar(100)
|
||||||
websiteId String @map("website_id") @db.Uuid
|
websiteId String @map("website_id") @db.Uuid
|
||||||
visitId String @map("visit_id") @db.Uuid
|
visitId String @map("visit_id") @db.Uuid
|
||||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
||||||
|
website Website @relation(fields: [websiteId], references: [id])
|
||||||
website Website @relation(fields: [websiteId], references: [id])
|
|
||||||
|
|
||||||
@@unique([websiteId, visitId])
|
@@unique([websiteId, visitId])
|
||||||
@@index([websiteId])
|
@@index([websiteId])
|
||||||
@@ -407,11 +393,11 @@ model SessionReplaySaved {
|
|||||||
model TwoFactorAuth {
|
model TwoFactorAuth {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
userId String @unique @map("user_id") @db.Uuid
|
userId String @unique @map("user_id") @db.Uuid
|
||||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
||||||
secret String
|
secret String
|
||||||
isEnabled Boolean @default(false) @map("is_enabled")
|
isEnabled Boolean @default(false) @map("is_enabled")
|
||||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(6)
|
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(6)
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
@@map("two_factor_auth")
|
@@map("two_factor_auth")
|
||||||
}
|
}
|
||||||
@@ -419,10 +405,10 @@ model TwoFactorAuth {
|
|||||||
model TwoFactorBackupCode {
|
model TwoFactorBackupCode {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
userId String @map("user_id") @db.Uuid
|
userId String @map("user_id") @db.Uuid
|
||||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
||||||
codeHash String @map("code_hash")
|
codeHash String @map("code_hash")
|
||||||
used Boolean @default(false)
|
used Boolean @default(false)
|
||||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
@@index([userId])
|
@@index([userId])
|
||||||
@@map("two_factor_backup_code")
|
@@map("two_factor_backup_code")
|
||||||
@@ -433,6 +419,7 @@ model TwoFactorOtpUsed {
|
|||||||
userId String @map("user_id") @db.Uuid
|
userId String @map("user_id") @db.Uuid
|
||||||
otp String
|
otp String
|
||||||
expiresAt DateTime @map("expires_at") @db.Timestamptz(6)
|
expiresAt DateTime @map("expires_at") @db.Timestamptz(6)
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
@@unique([userId, otp])
|
@@unique([userId, otp])
|
||||||
@@map("two_factor_otp_used")
|
@@map("two_factor_otp_used")
|
||||||
@@ -444,6 +431,7 @@ model TwoFactorRateLimit {
|
|||||||
attempts Int @default(0)
|
attempts Int @default(0)
|
||||||
lockedUntil DateTime? @map("locked_until") @db.Timestamptz(6)
|
lockedUntil DateTime? @map("locked_until") @db.Timestamptz(6)
|
||||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(6)
|
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(6)
|
||||||
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
@@map("two_factor_rate_limit")
|
@@map("two_factor_rate_limit")
|
||||||
}
|
}
|
||||||
@@ -453,4 +441,4 @@ model AppSetting {
|
|||||||
value String
|
value String
|
||||||
|
|
||||||
@@map("app_setting")
|
@@map("app_setting")
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user