Added congregation table and field
This commit is contained in:
@ -0,0 +1,33 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE `Assignment`
|
||||
ADD COLUMN `originalPublisherId` VARCHAR(191) NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Message` ADD COLUMN `publicUntil` DATETIME(3) NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Publisher`
|
||||
ADD COLUMN `congregationId` INTEGER NULL,
|
||||
ADD COLUMN `locale` VARCHAR(191) NULL DEFAULT 'bg';
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Report` ADD COLUMN `comments` VARCHAR(191) NULL;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Congregation` (
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(191) NOT NULL,
|
||||
`address` VARCHAR(191) NOT NULL,
|
||||
`isActive` BOOLEAN NOT NULL DEFAULT true,
|
||||
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Publisher`
|
||||
ADD CONSTRAINT `Publisher_congregationId_fkey` FOREIGN KEY (`congregationId`) REFERENCES `Congregation` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Assignment`
|
||||
ADD CONSTRAINT `Assignment_originalPublisherId_fkey` FOREIGN KEY (`originalPublisherId`) REFERENCES `Publisher` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
@ -124,6 +124,18 @@ model Publisher {
|
||||
EventLog EventLog[]
|
||||
lastLogin DateTime?
|
||||
pushSubscription Json?
|
||||
originalAssignments Assignment[] @relation("OriginalPublisher")
|
||||
congregation Congregation? @relation(fields: [congregationId], references: [id])
|
||||
congregationId Int?
|
||||
locale String? @default("bg")
|
||||
}
|
||||
|
||||
model Congregation {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
address String
|
||||
isActive Boolean @default(true)
|
||||
publishers Publisher[]
|
||||
}
|
||||
|
||||
model Availability {
|
||||
@ -181,23 +193,25 @@ model Shift {
|
||||
//date DateTime
|
||||
reportId Int? @unique
|
||||
Report Report? @relation(fields: [reportId], references: [id])
|
||||
isPublished Boolean @default(false) //NEW v1.0.1
|
||||
isPublished Boolean @default(false)
|
||||
EventLog EventLog[]
|
||||
|
||||
@@map("Shift")
|
||||
}
|
||||
|
||||
model Assignment {
|
||||
id Int @id @default(autoincrement())
|
||||
shift Shift @relation(fields: [shiftId], references: [id], onDelete: Cascade)
|
||||
shiftId Int
|
||||
publisher Publisher @relation(fields: [publisherId], references: [id], onDelete: Cascade)
|
||||
publisherId String
|
||||
isBySystem Boolean @default(false) // if no availability for it, when importing previous schedules
|
||||
isConfirmed Boolean @default(false)
|
||||
isWithTransport Boolean @default(false)
|
||||
isMailSent Boolean @default(false)
|
||||
publicGuid String? @unique
|
||||
id Int @id @default(autoincrement())
|
||||
shift Shift @relation(fields: [shiftId], references: [id], onDelete: Cascade)
|
||||
shiftId Int
|
||||
publisher Publisher @relation(fields: [publisherId], references: [id], onDelete: Cascade)
|
||||
publisherId String
|
||||
isBySystem Boolean @default(false) // if no availability for it, when importing previous schedules
|
||||
isConfirmed Boolean @default(false)
|
||||
isWithTransport Boolean @default(false)
|
||||
isMailSent Boolean @default(false)
|
||||
publicGuid String? @unique
|
||||
originalPublisherId String? // New field to store the original publisher id when the assignment is replaced
|
||||
originalPublisher Publisher? @relation("OriginalPublisher", fields: [originalPublisherId], references: [id])
|
||||
|
||||
@@map("Assignment")
|
||||
}
|
||||
@ -237,6 +251,7 @@ model Report {
|
||||
|
||||
experienceInfo String? @db.LongText
|
||||
type ReportType @default(ServiceReport)
|
||||
comments String?
|
||||
|
||||
@@map("Report")
|
||||
}
|
||||
@ -258,6 +273,7 @@ model Message {
|
||||
isRead Boolean @default(false)
|
||||
isPublic Boolean @default(false)
|
||||
type MessageType @default(Email)
|
||||
publicUntil DateTime?
|
||||
}
|
||||
|
||||
enum EventLogType {
|
||||
|
Reference in New Issue
Block a user