refactor: remove createdAt optional type

This commit is contained in:
moonrailgun 2023-10-10 00:04:25 +08:00
parent 6723b9f3da
commit 8466c0c39a

View File

@ -12,8 +12,8 @@ model User {
username String @unique @db.VarChar(255) username String @unique @db.VarChar(255)
password String @db.VarChar(60) password String @db.VarChar(60)
role String @db.VarChar(50) role String @db.VarChar(50)
createdAt DateTime? @default(now()) @db.Timestamptz(6) createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6) updatedAt DateTime @updatedAt @db.Timestamptz(6)
deletedAt DateTime? @db.Timestamptz(6) deletedAt DateTime? @db.Timestamptz(6)
currentWorkspaceId String? @db.VarChar(30) currentWorkspaceId String? @db.VarChar(30)
@ -25,8 +25,8 @@ model User {
model Workspace { model Workspace {
id String @id @unique @default(cuid()) @db.VarChar(30) id String @id @unique @default(cuid()) @db.VarChar(30)
name String @db.VarChar(100) name String @db.VarChar(100)
createdAt DateTime? @default(now()) @db.Timestamptz(6) createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6) updatedAt DateTime @updatedAt @db.Timestamptz(6)
users WorkspacesOnUsers[] users WorkspacesOnUsers[]
websites Website[] websites Website[]
@ -41,8 +41,8 @@ model WorkspacesOnUsers {
userId String @db.VarChar(30) userId String @db.VarChar(30)
workspaceId String @db.VarChar(30) workspaceId String @db.VarChar(30)
role String @db.VarChar(100) role String @db.VarChar(100)
createdAt DateTime? @default(now()) @db.Timestamptz(6) createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6) updatedAt DateTime @updatedAt @db.Timestamptz(6)
user User @relation(fields: [userId], references: [id], onUpdate: Cascade, onDelete: Cascade) user User @relation(fields: [userId], references: [id], onUpdate: Cascade, onDelete: Cascade)
workspace Workspace @relation(fields: [workspaceId], references: [id], onUpdate: Cascade, onDelete: Cascade) workspace Workspace @relation(fields: [workspaceId], references: [id], onUpdate: Cascade, onDelete: Cascade)
@ -59,8 +59,8 @@ model Website {
shareId String? @unique @db.VarChar(50) shareId String? @unique @db.VarChar(50)
resetAt DateTime? @db.Timestamptz(6) resetAt DateTime? @db.Timestamptz(6)
workspaceId String @db.VarChar(30) workspaceId String @db.VarChar(30)
createdAt DateTime? @default(now()) @db.Timestamptz(6) createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime? @updatedAt @db.Timestamptz(6) updatedAt DateTime @updatedAt @db.Timestamptz(6)
deletedAt DateTime? @db.Timestamptz(6) deletedAt DateTime? @db.Timestamptz(6)
workspace Workspace @relation(fields: [workspaceId], references: [id], onUpdate: Cascade, onDelete: Cascade) workspace Workspace @relation(fields: [workspaceId], references: [id], onUpdate: Cascade, onDelete: Cascade)
@ -88,7 +88,7 @@ model WebsiteSession {
subdivision1 String? @db.VarChar(20) subdivision1 String? @db.VarChar(20)
subdivision2 String? @db.VarChar(50) subdivision2 String? @db.VarChar(50)
city String? @db.VarChar(50) city String? @db.VarChar(50)
createdAt DateTime? @default(now()) @db.Timestamptz(6) createdAt DateTime @default(now()) @db.Timestamptz(6)
website Website @relation(fields: [websiteId], references: [id], onUpdate: Cascade, onDelete: Cascade) website Website @relation(fields: [websiteId], references: [id], onUpdate: Cascade, onDelete: Cascade)
@ -121,7 +121,7 @@ model WebsiteEvent {
pageTitle String? @db.VarChar(500) pageTitle String? @db.VarChar(500)
eventType Int @default(1) @db.Integer eventType Int @default(1) @db.Integer
eventName String? @db.VarChar(50) eventName String? @db.VarChar(50)
createdAt DateTime? @default(now()) @db.Timestamptz(6) createdAt DateTime @default(now()) @db.Timestamptz(6)
eventData WebsiteEventData[] eventData WebsiteEventData[]
session WebsiteSession @relation(fields: [sessionId], references: [id], onUpdate: Cascade, onDelete: Cascade) session WebsiteSession @relation(fields: [sessionId], references: [id], onUpdate: Cascade, onDelete: Cascade)
@ -147,7 +147,7 @@ model WebsiteEventData {
numberValue Decimal? @db.Decimal(19, 4) numberValue Decimal? @db.Decimal(19, 4)
dateValue DateTime? @db.Timestamptz(6) dateValue DateTime? @db.Timestamptz(6)
dataType Int @db.Integer dataType Int @db.Integer
createdAt DateTime? @default(now()) @db.Timestamptz(6) createdAt DateTime @default(now()) @db.Timestamptz(6)
website Website @relation(fields: [websiteId], references: [id], onUpdate: Cascade, onDelete: Cascade) website Website @relation(fields: [websiteId], references: [id], onUpdate: Cascade, onDelete: Cascade)
websiteEvent WebsiteEvent @relation(fields: [websiteEventId], references: [id], onUpdate: Cascade, onDelete: Cascade) websiteEvent WebsiteEvent @relation(fields: [websiteEventId], references: [id], onUpdate: Cascade, onDelete: Cascade)
@ -167,8 +167,7 @@ model WebsiteSessionData {
numberValue Decimal? @db.Decimal(19, 4) numberValue Decimal? @db.Decimal(19, 4)
dateValue DateTime? @db.Timestamptz(6) dateValue DateTime? @db.Timestamptz(6)
dataType Int @db.Integer dataType Int @db.Integer
createdAt DateTime? @default(now()) @db.Timestamptz(6) createdAt DateTime @default(now()) @db.Timestamptz(6)
deletedAt DateTime? @default(now()) @db.Timestamptz(6)
website Website @relation(fields: [websiteId], references: [id], onUpdate: Cascade, onDelete: Cascade) website Website @relation(fields: [websiteId], references: [id], onUpdate: Cascade, onDelete: Cascade)
session WebsiteSession @relation(fields: [sessionId], references: [id], onUpdate: Cascade, onDelete: Cascade) session WebsiteSession @relation(fields: [sessionId], references: [id], onUpdate: Cascade, onDelete: Cascade)
@ -188,7 +187,7 @@ model TelemetrySession {
subdivision1 String? @db.VarChar(20) subdivision1 String? @db.VarChar(20)
subdivision2 String? @db.VarChar(50) subdivision2 String? @db.VarChar(50)
city String? @db.VarChar(50) city String? @db.VarChar(50)
createdAt DateTime? @default(now()) @db.Timestamptz(6) createdAt DateTime @default(now()) @db.Timestamptz(6)
telemetryEvent TelemetryEvent[] telemetryEvent TelemetryEvent[]
@ -203,7 +202,7 @@ model TelemetryEvent {
eventName String? @db.VarChar(100) eventName String? @db.VarChar(100)
urlOrigin String @db.VarChar(500) urlOrigin String @db.VarChar(500)
urlPath String @db.VarChar(500) urlPath String @db.VarChar(500)
createdAt DateTime? @default(now()) @db.Timestamptz(6) createdAt DateTime @default(now()) @db.Timestamptz(6)
session TelemetrySession @relation(fields: [sessionId], references: [id], onUpdate: Cascade, onDelete: Cascade) session TelemetrySession @relation(fields: [sessionId], references: [id], onUpdate: Cascade, onDelete: Cascade)
@ -219,7 +218,7 @@ model Notification {
name String @db.VarChar(100) name String @db.VarChar(100)
type String @db.VarChar(100) type String @db.VarChar(100)
payload Json @db.Json payload Json @db.Json
createdAt DateTime? @default(now()) @db.Timestamptz(6) createdAt DateTime @default(now()) @db.Timestamptz(6)
workspace Workspace @relation(fields: [workspaceId], references: [id], onUpdate: Cascade, onDelete: Cascade) workspace Workspace @relation(fields: [workspaceId], references: [id], onUpdate: Cascade, onDelete: Cascade)
@ -239,7 +238,7 @@ model Monitor {
// maxRetry Int @default(0) @db.Integer // maxRetry Int @default(0) @db.Integer
// retryInterval Int @default(0) @db.Integer // retryInterval Int @default(0) @db.Integer
payload Json @db.Json payload Json @db.Json
createdAt DateTime? @default(now()) @db.Timestamptz(6) createdAt DateTime @default(now()) @db.Timestamptz(6)
workspace Workspace @relation(fields: [workspaceId], references: [id]) workspace Workspace @relation(fields: [workspaceId], references: [id])
@ -255,7 +254,7 @@ model MonitorEvent {
message String @db.VarChar(500) message String @db.VarChar(500)
monitorId String @db.VarChar(30) monitorId String @db.VarChar(30)
type String @db.VarChar(100) // UP or DOWN type String @db.VarChar(100) // UP or DOWN
createdAt DateTime? @default(now()) @db.Timestamptz(6) createdAt DateTime @default(now()) @db.Timestamptz(6)
monitor Monitor @relation(fields: [monitorId], references: [id], onUpdate: Cascade, onDelete: Cascade) monitor Monitor @relation(fields: [monitorId], references: [id], onUpdate: Cascade, onDelete: Cascade)
} }
@ -264,7 +263,7 @@ model MonitorData {
id String @id @default(cuid()) @db.VarChar(30) id String @id @default(cuid()) @db.VarChar(30)
monitorId String @db.VarChar(30) monitorId String @db.VarChar(30)
value Int @default(0) @db.Integer // -1 means error value Int @default(0) @db.Integer // -1 means error
createdAt DateTime? @default(now()) @db.Timestamptz(6) createdAt DateTime @default(now()) @db.Timestamptz(6)
monitor Monitor @relation(fields: [monitorId], references: [id], onUpdate: Cascade, onDelete: Cascade) monitor Monitor @relation(fields: [monitorId], references: [id], onUpdate: Cascade, onDelete: Cascade)
} }