new table - event log
This commit is contained in:
1
.env
1
.env
@ -8,6 +8,7 @@ NEXTAUTH_SECRET=ed8a9681efc414df89dfd03cd188ed58
|
|||||||
|
|
||||||
NODE_ENV=development
|
NODE_ENV=development
|
||||||
# mysql
|
# mysql
|
||||||
|
DATABASE=mysql://cart:cartpw@localhost:3306/cart
|
||||||
|
|
||||||
# // owner: dobromir.popov@gmail.com | Специално Свидетелстване София
|
# // owner: dobromir.popov@gmail.com | Специално Свидетелстване София
|
||||||
# // https://console.cloud.google.com/apis/credentials/oauthclient/926212607479-d3m8hm8f8esp3rf1639prskn445sa01v.apps.googleusercontent.com?project=grand-forge-108716
|
# // https://console.cloud.google.com/apis/credentials/oauthclient/926212607479-d3m8hm8f8esp3rf1639prskn445sa01v.apps.googleusercontent.com?project=grand-forge-108716
|
||||||
|
@ -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?
|
comments String?
|
||||||
reports Report[]
|
reports Report[]
|
||||||
Message Message[]
|
Message Message[]
|
||||||
|
EventLog EventLog[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model Availability {
|
model Availability {
|
||||||
@ -179,6 +180,7 @@ model Shift {
|
|||||||
reportId Int? @unique
|
reportId Int? @unique
|
||||||
Report Report? @relation(fields: [reportId], references: [id])
|
Report Report? @relation(fields: [reportId], references: [id])
|
||||||
isPublished Boolean @default(false) //NEW v1.0.1
|
isPublished Boolean @default(false) //NEW v1.0.1
|
||||||
|
EventLog EventLog[]
|
||||||
|
|
||||||
@@map("Shift")
|
@@map("Shift")
|
||||||
}
|
}
|
||||||
@ -256,6 +258,23 @@ model Message {
|
|||||||
type MessageType @default(Email)
|
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
|
//user auth and session management
|
||||||
model User {
|
model User {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
|
Reference in New Issue
Block a user