new table - event log
This commit is contained in:
@ -0,0 +1,20 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE `EventLog` (
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`date` DATETIME(3) NOT NULL,
|
||||
`publisherId` VARCHAR(191) NULL,
|
||||
`shiftId` INTEGER NULL,
|
||||
`content` VARCHAR(191) NOT NULL,
|
||||
`type` ENUM('AssignnementReplacementRequested', 'AssignnementReplacement', 'SentEmail') NOT NULL,
|
||||
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `EventLog`
|
||||
ADD CONSTRAINT `EventLog_publisherId_fkey` FOREIGN KEY (`publisherId`) REFERENCES `Publisher` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `EventLog`
|
||||
ADD CONSTRAINT `EventLog_shiftId_fkey` FOREIGN KEY (`shiftId`) REFERENCES `Shift` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
@ -121,6 +121,7 @@ model Publisher {
|
||||
comments String?
|
||||
reports Report[]
|
||||
Message Message[]
|
||||
EventLog EventLog[]
|
||||
}
|
||||
|
||||
model Availability {
|
||||
@ -179,6 +180,7 @@ model Shift {
|
||||
reportId Int? @unique
|
||||
Report Report? @relation(fields: [reportId], references: [id])
|
||||
isPublished Boolean @default(false) //NEW v1.0.1
|
||||
EventLog EventLog[]
|
||||
|
||||
@@map("Shift")
|
||||
}
|
||||
@ -256,6 +258,23 @@ model Message {
|
||||
type MessageType @default(Email)
|
||||
}
|
||||
|
||||
enum EventLogType {
|
||||
AssignnementReplacementRequested
|
||||
AssignnementReplacement
|
||||
SentEmail
|
||||
}
|
||||
|
||||
model EventLog {
|
||||
id Int @id @default(autoincrement())
|
||||
date DateTime
|
||||
publisherId String?
|
||||
publisher Publisher? @relation(fields: [publisherId], references: [id])
|
||||
shiftId Int?
|
||||
shift Shift? @relation(fields: [shiftId], references: [id])
|
||||
content String
|
||||
type EventLogType
|
||||
}
|
||||
|
||||
//user auth and session management
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
|
Reference in New Issue
Block a user