diff --git a/prisma/migrations/20221130072538_updates/migration.sql b/prisma/migrations/20221130072538_updates/migration.sql deleted file mode 100644 index 978530e..0000000 --- a/prisma/migrations/20221130072538_updates/migration.sql +++ /dev/null @@ -1,80 +0,0 @@ --- CreateTable -CREATE TABLE `Publisher` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `firstName` VARCHAR(191) NOT NULL, - `lastName` VARCHAR(191) NOT NULL, - `email` VARCHAR(191) NOT NULL, - `phone` VARCHAR(191) NULL, - `isActive` BOOLEAN NOT NULL DEFAULT true, - `age` INTEGER NULL, - - UNIQUE INDEX `Publisher_email_key`(`email`), - PRIMARY KEY (`id`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `Availability` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `publisherId` INTEGER NOT NULL, - `name` VARCHAR(191) NOT NULL, - `dayofweek` ENUM('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday') NOT NULL, - `startTime` DATETIME(3) NOT NULL, - `endTime` DATETIME(3) NOT NULL, - - PRIMARY KEY (`id`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `CartEvent` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `startTime` DATETIME(3) NOT NULL, - `endTime` DATETIME(3) NOT NULL, - `dayofweek` ENUM('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday') NOT NULL, - - PRIMARY KEY (`id`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `Shift` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `cartEventId` INTEGER NOT NULL, - `name` VARCHAR(191) NOT NULL, - `startTime` DATETIME(3) NOT NULL, - `endTime` DATETIME(3) NOT NULL, - `isActive` BOOLEAN NOT NULL DEFAULT true, - `requiresTransport` BOOLEAN NOT NULL DEFAULT false, - - PRIMARY KEY (`id`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `Location` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `name` VARCHAR(191) NOT NULL, - `address` VARCHAR(191) NOT NULL, - `isActive` BOOLEAN NOT NULL DEFAULT true, - `dayofweek` ENUM('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday') NOT NULL, - - PRIMARY KEY (`id`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `_PublisherToShift` ( - `A` INTEGER NOT NULL, - `B` INTEGER NOT NULL, - - UNIQUE INDEX `_PublisherToShift_AB_unique`(`A`, `B`), - INDEX `_PublisherToShift_B_index`(`B`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- AddForeignKey -ALTER TABLE `Availability` ADD CONSTRAINT `Availability_publisherId_fkey` FOREIGN KEY (`publisherId`) REFERENCES `Publisher`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Shift` ADD CONSTRAINT `Shift_cartEventId_fkey` FOREIGN KEY (`cartEventId`) REFERENCES `CartEvent`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `_PublisherToShift` ADD CONSTRAINT `_PublisherToShift_A_fkey` FOREIGN KEY (`A`) REFERENCES `Publisher`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `_PublisherToShift` ADD CONSTRAINT `_PublisherToShift_B_fkey` FOREIGN KEY (`B`) REFERENCES `Shift`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20221201223336_/migration.sql b/prisma/migrations/20221201223336_/migration.sql deleted file mode 100644 index 446e110..0000000 --- a/prisma/migrations/20221201223336_/migration.sql +++ /dev/null @@ -1,17 +0,0 @@ -/* - Warnings: - - - Added the required column `locationId` to the `CartEvent` table without a default value. This is not possible if the table is not empty. - - Added the required column `shiftDuration` to the `CartEvent` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE `Availability` ADD COLUMN `isActive` BOOLEAN NOT NULL DEFAULT true; - --- AlterTable -ALTER TABLE `CartEvent` ADD COLUMN `isActive` BOOLEAN NOT NULL DEFAULT true, - ADD COLUMN `locationId` INTEGER NOT NULL, - ADD COLUMN `shiftDuration` INTEGER NOT NULL; - --- AddForeignKey -ALTER TABLE `CartEvent` ADD CONSTRAINT `CartEvent_locationId_fkey` FOREIGN KEY (`locationId`) REFERENCES `Location`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20221203232123_shifts/migration.sql b/prisma/migrations/20221203232123_shifts/migration.sql deleted file mode 100644 index c138b9f..0000000 --- a/prisma/migrations/20221203232123_shifts/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `dayofweek` on the `Location` table. All the data in the column will be lost. - - Added the required column `date` to the `Shift` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE `Location` DROP COLUMN `dayofweek`; - --- AlterTable -ALTER TABLE `Shift` ADD COLUMN `date` DATETIME(3) NOT NULL; diff --git a/prisma/migrations/20221204144131_/migration.sql b/prisma/migrations/20221204144131_/migration.sql deleted file mode 100644 index 197c65a..0000000 --- a/prisma/migrations/20221204144131_/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `date` on the `Shift` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE `Shift` DROP COLUMN `date`; diff --git a/prisma/migrations/20221217220721_added_shift_is_tentative_event_type/migration.sql b/prisma/migrations/20221217220721_added_shift_is_tentative_event_type/migration.sql deleted file mode 100644 index d24041b..0000000 --- a/prisma/migrations/20221217220721_added_shift_is_tentative_event_type/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ --- AlterTable -ALTER TABLE `CartEvent` ADD COLUMN `eventType` ENUM('PW_Cart', 'KH_Cleaning') NOT NULL DEFAULT 'PW_Cart'; - --- AlterTable -ALTER TABLE `Shift` ADD COLUMN `isTentaive` BOOLEAN NOT NULL DEFAULT false; diff --git a/prisma/migrations/20221217221944_publisher_to_shift_renamed_assignment/migration.sql b/prisma/migrations/20221217221944_publisher_to_shift_renamed_assignment/migration.sql deleted file mode 100644 index cd87cb8..0000000 --- a/prisma/migrations/20221217221944_publisher_to_shift_renamed_assignment/migration.sql +++ /dev/null @@ -1,30 +0,0 @@ -/* - Warnings: - - - You are about to drop the `_PublisherToShift` table. If the table is not empty, all the data it contains will be lost. - -*/ --- DropForeignKey -ALTER TABLE `_PublisherToShift` DROP FOREIGN KEY `_PublisherToShift_A_fkey`; - --- DropForeignKey -ALTER TABLE `_PublisherToShift` DROP FOREIGN KEY `_PublisherToShift_B_fkey`; - --- DropTable -DROP TABLE `_PublisherToShift`; - --- CreateTable -CREATE TABLE `Assignment` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `shiftId` INTEGER NOT NULL, - `publisherId` INTEGER NOT NULL, - `isActive` BOOLEAN NOT NULL DEFAULT true, - - PRIMARY KEY (`id`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- AddForeignKey -ALTER TABLE `Assignment` ADD CONSTRAINT `Assignment_shiftId_fkey` FOREIGN KEY (`shiftId`) REFERENCES `Shift`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Assignment` ADD CONSTRAINT `Assignment_publisherId_fkey` FOREIGN KEY (`publisherId`) REFERENCES `Publisher`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20221218164331_fix_tentative_assignment_property/migration.sql b/prisma/migrations/20221218164331_fix_tentative_assignment_property/migration.sql deleted file mode 100644 index 5a4eb5b..0000000 --- a/prisma/migrations/20221218164331_fix_tentative_assignment_property/migration.sql +++ /dev/null @@ -1,11 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `isTentaive` on the `Shift` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE `Assignment` ADD COLUMN `isTentaive` BOOLEAN NOT NULL DEFAULT false; - --- AlterTable -ALTER TABLE `Shift` DROP COLUMN `isTentaive`; diff --git a/prisma/migrations/20221218164950_fix_name/migration.sql b/prisma/migrations/20221218164950_fix_name/migration.sql deleted file mode 100644 index 7afb51c..0000000 --- a/prisma/migrations/20221218164950_fix_name/migration.sql +++ /dev/null @@ -1,9 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `isTentaive` on the `Assignment` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE `Assignment` DROP COLUMN `isTentaive`, - ADD COLUMN `isTentative` BOOLEAN NOT NULL DEFAULT false; diff --git a/prisma/migrations/20221218183319_test/migration.sql b/prisma/migrations/20221218183319_test/migration.sql deleted file mode 100644 index effa85f..0000000 --- a/prisma/migrations/20221218183319_test/migration.sql +++ /dev/null @@ -1,23 +0,0 @@ --- DropForeignKey -ALTER TABLE `Assignment` DROP FOREIGN KEY `Assignment_publisherId_fkey`; - --- DropForeignKey -ALTER TABLE `Assignment` DROP FOREIGN KEY `Assignment_shiftId_fkey`; - --- DropForeignKey -ALTER TABLE `Availability` DROP FOREIGN KEY `Availability_publisherId_fkey`; - --- DropForeignKey -ALTER TABLE `Shift` DROP FOREIGN KEY `Shift_cartEventId_fkey`; - --- AddForeignKey -ALTER TABLE `Availability` ADD CONSTRAINT `Availability_publisherId_fkey` FOREIGN KEY (`publisherId`) REFERENCES `Publisher`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Shift` ADD CONSTRAINT `Shift_cartEventId_fkey` FOREIGN KEY (`cartEventId`) REFERENCES `CartEvent`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Assignment` ADD CONSTRAINT `Assignment_shiftId_fkey` FOREIGN KEY (`shiftId`) REFERENCES `Shift`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Assignment` ADD CONSTRAINT `Assignment_publisherId_fkey` FOREIGN KEY (`publisherId`) REFERENCES `Publisher`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20221218224910_users_auth/migration.sql b/prisma/migrations/20221218224910_users_auth/migration.sql deleted file mode 100644 index d2b570d..0000000 --- a/prisma/migrations/20221218224910_users_auth/migration.sql +++ /dev/null @@ -1,75 +0,0 @@ -/* - Warnings: - - - The primary key for the `Publisher` table will be changed. If it partially fails, the table could be left without primary key constraint. - -*/ --- DropForeignKey -ALTER TABLE `Assignment` DROP FOREIGN KEY `Assignment_publisherId_fkey`; - --- DropForeignKey -ALTER TABLE `Availability` DROP FOREIGN KEY `Availability_publisherId_fkey`; - --- AlterTable -ALTER TABLE `Assignment` MODIFY `publisherId` VARCHAR(191) NOT NULL; - --- AlterTable -ALTER TABLE `Availability` MODIFY `publisherId` VARCHAR(191) NOT NULL; - --- AlterTable -ALTER TABLE `Publisher` DROP PRIMARY KEY, - ADD COLUMN `emailVerified` DATETIME(3) NULL, - MODIFY `id` VARCHAR(191) NOT NULL, - ADD PRIMARY KEY (`id`); - --- CreateTable -CREATE TABLE `Account` ( - `id` VARCHAR(191) NOT NULL, - `userId` VARCHAR(191) NOT NULL, - `type` VARCHAR(191) NOT NULL, - `provider` VARCHAR(191) NOT NULL, - `providerAccountId` VARCHAR(191) NOT NULL, - `refresh_token` VARCHAR(191) NULL, - `access_token` VARCHAR(191) NULL, - `expires_at` INTEGER NULL, - `token_type` VARCHAR(191) NULL, - `scope` VARCHAR(191) NULL, - `id_token` VARCHAR(191) NULL, - `session_state` VARCHAR(191) NULL, - - UNIQUE INDEX `Account_provider_providerAccountId_key`(`provider`, `providerAccountId`), - PRIMARY KEY (`id`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `Session` ( - `id` VARCHAR(191) NOT NULL, - `sessionToken` VARCHAR(191) NOT NULL, - `userId` VARCHAR(191) NOT NULL, - `expires` DATETIME(3) NOT NULL, - - UNIQUE INDEX `Session_sessionToken_key`(`sessionToken`), - PRIMARY KEY (`id`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateTable -CREATE TABLE `VerificationToken` ( - `identifier` VARCHAR(191) NOT NULL, - `token` VARCHAR(191) NOT NULL, - `expires` DATETIME(3) NOT NULL, - - UNIQUE INDEX `VerificationToken_token_key`(`token`), - UNIQUE INDEX `VerificationToken_identifier_token_key`(`identifier`, `token`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- AddForeignKey -ALTER TABLE `Availability` ADD CONSTRAINT `Availability_publisherId_fkey` FOREIGN KEY (`publisherId`) REFERENCES `Publisher`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Assignment` ADD CONSTRAINT `Assignment_publisherId_fkey` FOREIGN KEY (`publisherId`) REFERENCES `Publisher`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Account` ADD CONSTRAINT `Account_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `Publisher`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Session` ADD CONSTRAINT `Session_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `Publisher`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20230326221139_added_daily_availability_support/migration.sql b/prisma/migrations/20230326221139_added_daily_availability_support/migration.sql deleted file mode 100644 index ba33e31..0000000 --- a/prisma/migrations/20230326221139_added_daily_availability_support/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ --- AlterTable -ALTER TABLE `Availability` ADD COLUMN `dayOfMonth` INTEGER NULL; - --- AlterTable -ALTER TABLE `CartEvent` ADD COLUMN `numberOfPublishers` INTEGER NOT NULL DEFAULT 3; - --- AlterTable -ALTER TABLE `Publisher` ADD COLUMN `role` ENUM('ADMIN', 'USER') NOT NULL DEFAULT 'USER'; diff --git a/prisma/migrations/20230331002935_/migration.sql b/prisma/migrations/20230331002935_/migration.sql deleted file mode 100644 index a85ab7f..0000000 --- a/prisma/migrations/20230331002935_/migration.sql +++ /dev/null @@ -1,3 +0,0 @@ --- AlterTable -ALTER TABLE `Publisher` ADD COLUMN `desiredShiftsPerMonth` INTEGER NOT NULL DEFAULT 4, - MODIFY `role` ENUM('ADMIN', 'USER', 'EXTERNAL') NOT NULL DEFAULT 'USER'; diff --git a/prisma/migrations/20230427092015_add_publisher_details/migration.sql b/prisma/migrations/20230427092015_add_publisher_details/migration.sql deleted file mode 100644 index 7727ba8..0000000 --- a/prisma/migrations/20230427092015_add_publisher_details/migration.sql +++ /dev/null @@ -1,7 +0,0 @@ --- AlterTable -ALTER TABLE `Publisher` ADD COLUMN `isMale` BOOLEAN NOT NULL DEFAULT true, - ADD COLUMN `isNameForeign` BOOLEAN NOT NULL DEFAULT false, - ADD COLUMN `parentId` VARCHAR(191) NULL; - --- AddForeignKey -ALTER TABLE `Publisher` ADD CONSTRAINT `Publisher_parentId_fkey` FOREIGN KEY (`parentId`) REFERENCES `Publisher`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20230427203518_added_isimported_flag_in_publishers/migration.sql b/prisma/migrations/20230427203518_added_isimported_flag_in_publishers/migration.sql deleted file mode 100644 index 02829c1..0000000 --- a/prisma/migrations/20230427203518_added_isimported_flag_in_publishers/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE `Publisher` ADD COLUMN `isImported` BOOLEAN NOT NULL DEFAULT false; diff --git a/prisma/migrations/20230519203524_/migration.sql b/prisma/migrations/20230519203524_/migration.sql deleted file mode 100644 index 5bbcbb9..0000000 --- a/prisma/migrations/20230519203524_/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE `Shift` ADD COLUMN `notes` VARCHAR(191) NULL; diff --git a/prisma/migrations/20230528174049_add_availability_weekofmonth_for_weekly_availabilities/migration.sql b/prisma/migrations/20230528174049_add_availability_weekofmonth_for_weekly_availabilities/migration.sql deleted file mode 100644 index 499f13e..0000000 --- a/prisma/migrations/20230528174049_add_availability_weekofmonth_for_weekly_availabilities/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE `Availability` ADD COLUMN `weekOfMonth` INTEGER NULL; diff --git a/prisma/migrations/20231101100714_added_transport_and_availability_type/migration.sql b/prisma/migrations/20231101100714_added_transport_and_availability_type/migration.sql deleted file mode 100644 index 993eb6e..0000000 --- a/prisma/migrations/20231101100714_added_transport_and_availability_type/migration.sql +++ /dev/null @@ -1,18 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `parentId` on the `Publisher` table. All the data in the column will be lost. - -*/ --- DropForeignKey -ALTER TABLE `Publisher` DROP FOREIGN KEY `Publisher_parentId_fkey`; - --- AlterTable -ALTER TABLE `Assignment` ADD COLUMN `isWithTransport` BOOLEAN NOT NULL DEFAULT false; - --- AlterTable -ALTER TABLE `Publisher` DROP COLUMN `parentId`, - ADD COLUMN `familyHeadId` VARCHAR(191) NULL; - --- AddForeignKey -ALTER TABLE `Publisher` ADD CONSTRAINT `Publisher_familyHeadId_fkey` FOREIGN KEY (`familyHeadId`) REFERENCES `Publisher`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20231103095610_added_publisher_type/migration.sql b/prisma/migrations/20231103095610_added_publisher_type/migration.sql deleted file mode 100644 index 9875500..0000000 --- a/prisma/migrations/20231103095610_added_publisher_type/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ --- AlterTable -ALTER TABLE `Availability` ADD COLUMN `isWithTransport` BOOLEAN NOT NULL DEFAULT false, - ADD COLUMN `type` ENUM('Weekly', 'Monthly', 'OneTime', 'PreviousAssignment') NOT NULL DEFAULT 'Weekly'; - --- AlterTable -ALTER TABLE `Publisher` ADD COLUMN `comments` VARCHAR(191) NULL, - ADD COLUMN `town` VARCHAR(191) NULL, - ADD COLUMN `type` ENUM('Publisher', 'Bethelite', 'RegularPioneer', 'SpecialPioneer', 'Missionary', 'CircuitOverseer') NOT NULL DEFAULT 'Publisher'; diff --git a/prisma/migrations/20231130130317_added_more_availability_flags/migration.sql b/prisma/migrations/20231130130317_added_more_availability_flags/migration.sql deleted file mode 100644 index a1fad6d..0000000 --- a/prisma/migrations/20231130130317_added_more_availability_flags/migration.sql +++ /dev/null @@ -1,3 +0,0 @@ --- AlterTable -ALTER TABLE `Availability` ADD COLUMN `isFromPreviousAssignment` BOOLEAN NOT NULL DEFAULT false, - ADD COLUMN `isFromPreviousMonth` BOOLEAN NOT NULL DEFAULT false; diff --git a/prisma/migrations/20231214163235_fix_nextauth_schema/migration.sql b/prisma/migrations/20231214163235_fix_nextauth_schema/migration.sql deleted file mode 100644 index de2253a..0000000 --- a/prisma/migrations/20231214163235_fix_nextauth_schema/migration.sql +++ /dev/null @@ -1,42 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `emailVerified` on the `Publisher` table. All the data in the column will be lost. - - A unique constraint covering the columns `[userId]` on the table `Publisher` will be added. If there are existing duplicate values, this will fail. - -*/ --- DropForeignKey -ALTER TABLE `Account` DROP FOREIGN KEY `Account_userId_fkey`; - --- DropForeignKey -ALTER TABLE `Session` DROP FOREIGN KEY `Session_userId_fkey`; - --- AlterTable -ALTER TABLE `Publisher` DROP COLUMN `emailVerified`, - ADD COLUMN `userId` VARCHAR(191) NULL; - --- CreateTable -CREATE TABLE `User` ( - `id` VARCHAR(191) NOT NULL, - `name` VARCHAR(191) NULL, - `email` VARCHAR(191) NULL, - `emailVerified` DATETIME(3) NULL, - `image` VARCHAR(191) NULL, - `publisherId` VARCHAR(191) NULL, - - UNIQUE INDEX `User_email_key`(`email`), - UNIQUE INDEX `User_publisherId_key`(`publisherId`), - PRIMARY KEY (`id`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- CreateIndex -CREATE UNIQUE INDEX `Publisher_userId_key` ON `Publisher`(`userId`); - --- AddForeignKey -ALTER TABLE `Publisher` ADD CONSTRAINT `Publisher_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Account` ADD CONSTRAINT `Account_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Session` ADD CONSTRAINT `Session_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20240109131156_email_is_unique_again/migration.sql b/prisma/migrations/20240109131156_email_is_unique_again/migration.sql deleted file mode 100644 index 26247f8..0000000 --- a/prisma/migrations/20240109131156_email_is_unique_again/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- This is an empty migration. --- CREATE INDEX `Publisher_email_key` ON `Publisher` (email); diff --git a/prisma/migrations/20240110211115_create_report_table/migration.sql b/prisma/migrations/20240110211115_create_report_table/migration.sql deleted file mode 100644 index 913114e..0000000 --- a/prisma/migrations/20240110211115_create_report_table/migration.sql +++ /dev/null @@ -1,23 +0,0 @@ --- AlterTable -ALTER TABLE `Publisher` MODIFY `role` ENUM('ADMIN', 'POWERUSER', 'USER', 'EXTERNAL') NOT NULL DEFAULT 'USER'; - --- CreateTable -CREATE TABLE `Report` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `date` DATETIME(3) NOT NULL, - `publisherId` VARCHAR(191) NOT NULL, - `assignmentId` INTEGER NOT NULL, - `placementCount` INTEGER NOT NULL, - `videoCount` INTEGER NOT NULL, - `returnVisitInfoCount` INTEGER NOT NULL, - `conversationCount` INTEGER NOT NULL, - `experienceInfo` VARCHAR(191) NOT NULL, - - PRIMARY KEY (`id`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- AddForeignKey -ALTER TABLE `Report` ADD CONSTRAINT `Report_publisherId_fkey` FOREIGN KEY (`publisherId`) REFERENCES `Publisher`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Report` ADD CONSTRAINT `Report_assignmentId_fkey` FOREIGN KEY (`assignmentId`) REFERENCES `Assignment`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20240110220327_link_experiece_to_location/migration.sql b/prisma/migrations/20240110220327_link_experiece_to_location/migration.sql deleted file mode 100644 index 696c379..0000000 --- a/prisma/migrations/20240110220327_link_experiece_to_location/migration.sql +++ /dev/null @@ -1,23 +0,0 @@ -/* - Warnings: - - - Added the required column `locationId` to the `Report` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE `Report` DROP FOREIGN KEY `Report_assignmentId_fkey`; - --- AlterTable -ALTER TABLE `Report` ADD COLUMN `locationId` INTEGER NOT NULL, - MODIFY `assignmentId` INTEGER NULL, - MODIFY `placementCount` INTEGER NULL, - MODIFY `videoCount` INTEGER NULL, - MODIFY `returnVisitInfoCount` INTEGER NULL, - MODIFY `conversationCount` INTEGER NULL, - MODIFY `experienceInfo` VARCHAR(191) NULL; - --- AddForeignKey -ALTER TABLE `Report` ADD CONSTRAINT `Report_locationId_fkey` FOREIGN KEY (`locationId`) REFERENCES `Location`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE `Report` ADD CONSTRAINT `Report_assignmentId_fkey` FOREIGN KEY (`assignmentId`) REFERENCES `Assignment`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20240110225201_modify_experience_info_type/migration.sql b/prisma/migrations/20240110225201_modify_experience_info_type/migration.sql deleted file mode 100644 index 5f60026..0000000 --- a/prisma/migrations/20240110225201_modify_experience_info_type/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE `Report` MODIFY `experienceInfo` LONGTEXT NULL; diff --git a/prisma/migrations/20240110233944_report_s_location_is_optional/migration.sql b/prisma/migrations/20240110233944_report_s_location_is_optional/migration.sql deleted file mode 100644 index b998bae..0000000 --- a/prisma/migrations/20240110233944_report_s_location_is_optional/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ --- DropForeignKey -ALTER TABLE `Report` DROP FOREIGN KEY `Report_locationId_fkey`; - --- AlterTable -ALTER TABLE `Report` MODIFY `locationId` INTEGER NULL; - --- AddForeignKey -ALTER TABLE `Report` ADD CONSTRAINT `Report_locationId_fkey` FOREIGN KEY (`locationId`) REFERENCES `Location`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20240111221838_update_availability/migration.sql b/prisma/migrations/20240111221838_update_availability/migration.sql deleted file mode 100644 index 2813d14..0000000 --- a/prisma/migrations/20240111221838_update_availability/migration.sql +++ /dev/null @@ -1,3 +0,0 @@ --- AlterTable -ALTER TABLE `Availability` ADD COLUMN `endDate` DATETIME(3) NULL, - ADD COLUMN `repeatWeekly` BOOLEAN NULL; diff --git a/prisma/migrations/20240112104657_adding_assignment_guids/migration.sql b/prisma/migrations/20240112104657_adding_assignment_guids/migration.sql deleted file mode 100644 index 1fb983b..0000000 --- a/prisma/migrations/20240112104657_adding_assignment_guids/migration.sql +++ /dev/null @@ -1,32 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `isTentative` on the `assignment` table. All the data in the column will be lost. - - You are about to drop the column `assignmentId` on the `report` table. All the data in the column will be lost. - - A unique constraint covering the columns `[publicGuid]` on the table `Assignment` will be added. If there are existing duplicate values, this will fail. - - A unique constraint covering the columns `[reportId]` on the table `Shift` will be added. If there are existing duplicate values, this will fail. - -*/ --- DropForeignKey -ALTER TABLE `Report` DROP FOREIGN KEY `Report_assignmentId_fkey`; - --- AlterTable -ALTER TABLE `Assignment` DROP COLUMN `isTentative`, - ADD COLUMN `isConfirmed` BOOLEAN NOT NULL DEFAULT false, - ADD COLUMN `isMailSent` BOOLEAN NOT NULL DEFAULT false, - ADD COLUMN `publicGuid` VARCHAR(191) NULL; - --- AlterTable -ALTER TABLE `Report` DROP COLUMN `assignmentId`; - --- AlterTable -ALTER TABLE `Shift` ADD COLUMN `reportId` INTEGER NULL; - --- CreateIndex -CREATE UNIQUE INDEX `Assignment_publicGuid_key` ON `Assignment`(`publicGuid`); - --- CreateIndex -CREATE UNIQUE INDEX `Shift_reportId_key` ON `Shift`(`reportId`); - --- AddForeignKey -ALTER TABLE `Shift` ADD CONSTRAINT `Shift_reportId_fkey` FOREIGN KEY (`reportId`) REFERENCES `Report`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20240127235643_add_location_content/migration.sql b/prisma/migrations/20240127235643_add_location_content/migration.sql deleted file mode 100644 index b266a3d..0000000 --- a/prisma/migrations/20240127235643_add_location_content/migration.sql +++ /dev/null @@ -1,9 +0,0 @@ --- AlterTable -ALTER TABLE `Location` ADD COLUMN `backupLocationId` INTEGER NULL, - ADD COLUMN `content` TEXT NULL; - --- AlterTable -ALTER TABLE `Publisher` ADD COLUMN `isTrained` BOOLEAN NOT NULL DEFAULT false; - --- AddForeignKey -ALTER TABLE `Location` ADD CONSTRAINT `Location_backupLocationId_fkey` FOREIGN KEY (`backupLocationId`) REFERENCES `Location`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20240131113517_assignment_isactive_renamed_istetative/migration.sql b/prisma/migrations/20240131113517_assignment_isactive_renamed_istetative/migration.sql deleted file mode 100644 index 55bc254..0000000 --- a/prisma/migrations/20240131113517_assignment_isactive_renamed_istetative/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `isActive` on the `assignment` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE `Assignment` DROP COLUMN `isActive`, - ADD COLUMN `isTentative` BOOLEAN NOT NULL DEFAULT false; - --- AlterTable -ALTER TABLE `Location` MODIFY `content` LONGTEXT NULL; diff --git a/prisma/migrations/20240201214719_assignment_add_repeat_frequency/migration.sql b/prisma/migrations/20240201214719_assignment_add_repeat_frequency/migration.sql deleted file mode 100644 index bf28ae4..0000000 --- a/prisma/migrations/20240201214719_assignment_add_repeat_frequency/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE `Availability` ADD COLUMN `repeatFrequency` INTEGER NULL; diff --git a/prisma/migrations/20240203144059_add_location_pictures/migration.sql b/prisma/migrations/20240203144059_add_location_pictures/migration.sql deleted file mode 100644 index 54b1fae..0000000 --- a/prisma/migrations/20240203144059_add_location_pictures/migration.sql +++ /dev/null @@ -1,4 +0,0 @@ --- AlterTable -ALTER TABLE `Location` ADD COLUMN `picture1` VARCHAR(191) NULL, - ADD COLUMN `picture2` VARCHAR(191) NULL, - ADD COLUMN `picture3` VARCHAR(191) NULL; diff --git a/prisma/migrations/20240221154126_misc/migration.sql b/prisma/migrations/20240221154126_misc/migration.sql deleted file mode 100644 index 0ff9a68..0000000 --- a/prisma/migrations/20240221154126_misc/migration.sql +++ /dev/null @@ -1,15 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `isWithTransport` on the `Availability` table. All the data in the column will be lost. - - The values [SpecialPioneer,Missionary,CircuitOverseer] on the enum `Publisher_type` will be removed. If these variants are still used in the database, this will fail. - -*/ --- AlterTable -ALTER TABLE `Availability` DROP COLUMN `isWithTransport`, - ADD COLUMN `isWithTransportIn` BOOLEAN NOT NULL DEFAULT false, - ADD COLUMN `isWithTransportOut` BOOLEAN NOT NULL DEFAULT false, - MODIFY `type` ENUM('Weekly', 'Monthly', 'OneTime', 'PreviousAssignment', 'ReplacementOnly') NOT NULL DEFAULT 'Weekly'; - --- AlterTable -ALTER TABLE `Publisher` MODIFY `type` ENUM('Publisher', 'Bethelite', 'RegularPioneer', 'SpecialPioneer_Missionary') NOT NULL DEFAULT 'Publisher'; diff --git a/prisma/migrations/20240302161855_some_new_fields/migration.sql b/prisma/migrations/20240302161855_some_new_fields/migration.sql deleted file mode 100644 index 730a0bb..0000000 --- a/prisma/migrations/20240302161855_some_new_fields/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ --- AlterTable -ALTER TABLE `Publisher` ADD COLUMN `alwaysAsFamily` BOOLEAN NULL DEFAULT false; - --- AlterTable -ALTER TABLE `Shift` ADD COLUMN `isPublished` BOOLEAN NOT NULL DEFAULT false; diff --git a/prisma/migrations/20240305111150_add_availability_date_of_entry/migration.sql b/prisma/migrations/20240305111150_add_availability_date_of_entry/migration.sql deleted file mode 100644 index d0d0e08..0000000 --- a/prisma/migrations/20240305111150_add_availability_date_of_entry/migration.sql +++ /dev/null @@ -1,18 +0,0 @@ --- AlterTable -ALTER TABLE `Availability` ADD COLUMN `dateOfEntry` DATETIME(3) NULL; - --- CreateTable -CREATE TABLE `Message` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `publisherId` VARCHAR(191) NOT NULL, - `date` DATETIME(3) NOT NULL, - `content` VARCHAR(191) NOT NULL, - `isRead` BOOLEAN NOT NULL DEFAULT false, - `isPublic` BOOLEAN NOT NULL DEFAULT false, - `type` ENUM('Email', 'SMS', 'Push', 'InApp') NOT NULL DEFAULT 'Email', - - PRIMARY KEY (`id`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- AddForeignKey -ALTER TABLE `Message` ADD CONSTRAINT `Message_publisherId_fkey` FOREIGN KEY (`publisherId`) REFERENCES `Publisher`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240325214807_misc_renames/migration.sql b/prisma/migrations/20240325214807_misc_renames/migration.sql deleted file mode 100644 index 890be7a..0000000 --- a/prisma/migrations/20240325214807_misc_renames/migration.sql +++ /dev/null @@ -1,21 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `isTentative` on the `Assignment` table. All the data in the column will be lost. - -*/ - --- AlterTable -ALTER TABLE `Assignment` - ADD COLUMN `isBySystem` BOOLEAN NOT NULL DEFAULT FALSE; - --- Depending on your DBMS, you might need to execute one statement at a time. --- Especially, the UPDATE statement should be run separately. -UPDATE `Assignment` SET `isBySystem` = isTentative; - --- Drop the isTentative column -ALTER TABLE `Assignment` DROP COLUMN `isTentative`; - --- AlterTable -ALTER TABLE `Report` - ADD COLUMN `type` ENUM('ServiceReport', 'Experience', 'Feedback_Problem', 'Feedback_Suggestion', 'Feedback') NOT NULL DEFAULT 'ServiceReport'; diff --git a/prisma/migrations/20240328162213_add_availability_self_ref/migration.sql b/prisma/migrations/20240328162213_add_availability_self_ref/migration.sql deleted file mode 100644 index bd11572..0000000 --- a/prisma/migrations/20240328162213_add_availability_self_ref/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ --- AlterTable -ALTER TABLE `Availability` ADD COLUMN `parentAvailabilityId` INTEGER NULL; - --- AddForeignKey -ALTER TABLE `Availability` ADD CONSTRAINT `Availability_parentAvailabilityId_fkey` FOREIGN KEY (`parentAvailabilityId`) REFERENCES `Availability`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20240401231200_add_publisher_email_sbscription_options/migration.sql b/prisma/migrations/20240401231200_add_publisher_email_sbscription_options/migration.sql deleted file mode 100644 index e7f91bc..0000000 --- a/prisma/migrations/20240401231200_add_publisher_email_sbscription_options/migration.sql +++ /dev/null @@ -1,3 +0,0 @@ --- AlterTable -ALTER TABLE `Publisher` ADD COLUMN `isSubscribedToCoverMe` BOOLEAN NOT NULL DEFAULT false, - ADD COLUMN `isSubscribedToReminders` BOOLEAN NOT NULL DEFAULT false; diff --git a/prisma/migrations/20240418092928_add_event_log_table/migration.sql b/prisma/migrations/20240418092928_add_event_log_table/migration.sql deleted file mode 100644 index 2f4ef0d..0000000 --- a/prisma/migrations/20240418092928_add_event_log_table/migration.sql +++ /dev/null @@ -1,20 +0,0 @@ --- CreateTable -CREATE TABLE `EventLog` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `date` DATETIME(3) NOT NULL, - `publisherId` VARCHAR(191) NULL, - `shiftId` INTEGER NULL, - `content` VARCHAR(5000) NOT NULL, - `type` ENUM('AssignmentReplacementRequested', 'AssignmentReplacementAccepted', '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; \ No newline at end of file diff --git a/prisma/migrations/20240425155607_add_publisher_last_login/migration.sql b/prisma/migrations/20240425155607_add_publisher_last_login/migration.sql deleted file mode 100644 index 10d5928..0000000 --- a/prisma/migrations/20240425155607_add_publisher_last_login/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE `Publisher` ADD COLUMN `lastLogin` DATETIME(3) NULL; \ No newline at end of file diff --git a/prisma/migrations/20240429133812_/migration.sql b/prisma/migrations/20240429133812_/migration.sql deleted file mode 100644 index 76f1dda..0000000 --- a/prisma/migrations/20240429133812_/migration.sql +++ /dev/null @@ -1,3 +0,0 @@ --- AlterTable -ALTER TABLE `User` -ADD COLUMN `passwordHashLocalAccount` VARCHAR(191) NULL; \ No newline at end of file diff --git a/prisma/migrations/20240429233926_add_eventlog_types/migration.sql b/prisma/migrations/20240429233926_add_eventlog_types/migration.sql deleted file mode 100644 index 50a566d..0000000 --- a/prisma/migrations/20240429233926_add_eventlog_types/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ --- AlterTable -ALTER TABLE `EventLog` -MODIFY `type` ENUM( - 'AssignmentReplacementRequested', 'AssignmentReplacementAccepted', 'SentEmail', 'PasswordResetRequested', 'PasswordResetEmailConfirmed', 'PasswordResetCompleted' -) NOT NULL; \ No newline at end of file diff --git a/prisma/migrations/20240506162944_add_publiher_push_subsctiption/migration.sql b/prisma/migrations/20240506162944_add_publiher_push_subsctiption/migration.sql deleted file mode 100644 index 332899f..0000000 --- a/prisma/migrations/20240506162944_add_publiher_push_subsctiption/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE `Publisher` ADD COLUMN `pushSubscription` JSON NULL; \ No newline at end of file diff --git a/prisma/migrations/20240510131656_publisher_congregation/migration.sql b/prisma/migrations/20240510131656_publisher_congregation/migration.sql deleted file mode 100644 index 133bedf..0000000 --- a/prisma/migrations/20240510131656_publisher_congregation/migration.sql +++ /dev/null @@ -1,33 +0,0 @@ --- 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; \ No newline at end of file diff --git a/prisma/migrations/20240511112711_aded_enum_options/migration.sql b/prisma/migrations/20240511112711_aded_enum_options/migration.sql deleted file mode 100644 index 2769eb0..0000000 --- a/prisma/migrations/20240511112711_aded_enum_options/migration.sql +++ /dev/null @@ -1,19 +0,0 @@ --- AlterTable -ALTER TABLE `EventLog` -MODIFY `type` ENUM( - 'AssignmentReplacementManual', 'AssignmentReplacementRequested', 'AssignmentReplacementAccepted', 'SentEmail', 'PasswordResetRequested', 'PasswordResetEmailConfirmed', 'PasswordResetCompleted' -) NOT NULL; - -INSERT INTO - `Congregation` -VALUES (1, 'Перник', '', 1), - (2, 'София Люлин', '', 1), - (3, 'София Юг', '', 1), - (4, 'София Надежда', '', 1), - (5, 'София Руски', '', 1), - (6, 'София Факултета', '', 1), - (7, 'София Изток', '', 1), - (8, 'София Младост', '', 1), - (9, 'София Английски', '', 1), - (10, 'Ботевград', '', 1), - (11, 'София Дружба', '', 1); \ No newline at end of file diff --git a/prisma/migrations/20240524150310_/migration.sql b/prisma/migrations/20240524150310_/migration.sql deleted file mode 100644 index 9fa4e1a..0000000 --- a/prisma/migrations/20240524150310_/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE `User` ADD COLUMN `emailVerifyToken` VARCHAR(191) NULL; \ No newline at end of file diff --git a/prisma/migrations/20240614185207_/migration.sql b/prisma/migrations/20240614185207_/migration.sql deleted file mode 100644 index fb8827e..0000000 --- a/prisma/migrations/20240614185207_/migration.sql +++ /dev/null @@ -1,9 +0,0 @@ --- CreateTable -CREATE TABLE `Settings` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `key` VARCHAR(191) NOT NULL, - `value` VARCHAR(191) NOT NULL, - `description` VARCHAR(191) NULL, - - PRIMARY KEY (`id`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; diff --git a/prisma/migrations/20240614213436_modify_settings_table/migration.sql b/prisma/migrations/20240614213436_modify_settings_table/migration.sql deleted file mode 100644 index 8c71f7c..0000000 --- a/prisma/migrations/20240614213436_modify_settings_table/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ -/* -Warnings: -- The primary key for the `settings` table will be changed. If it partially fails, the table could be left without primary key constraint. -- You are about to drop the column `id` on the `settings` table. All the data in the column will be lost. -*/ --- AlterTable -ALTER TABLE `Settings` -DROP PRIMARY KEY, -DROP COLUMN `id`, -ADD PRIMARY KEY (`key`); \ No newline at end of file diff --git a/prisma/migrations/20240616203120_add_survey_table/migration.sql b/prisma/migrations/20240616203120_add_survey_table/migration.sql deleted file mode 100644 index e2bc703..0000000 --- a/prisma/migrations/20240616203120_add_survey_table/migration.sql +++ /dev/null @@ -1,22 +0,0 @@ --- AlterTable -ALTER TABLE `Message` -ADD COLUMN `answer` VARCHAR(191) NULL, -ADD COLUMN `answerDate` DATETIME(3) NULL, -ADD COLUMN `shownDate` DATETIME(3) NULL, -ADD COLUMN `surveyId` INTEGER NULL; - --- CreateTable -CREATE TABLE `Survey` ( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `content` VARCHAR(191) NOT NULL, - `answers` JSON NULL, - `publicFrom` DATETIME(3) NULL, - `publicUntil` DATETIME(3) NULL, - - - PRIMARY KEY (`id`) -) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - --- AddForeignKey -ALTER TABLE `Message` -ADD CONSTRAINT `Message_surveyId_fkey` FOREIGN KEY (`surveyId`) REFERENCES `Survey` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; \ No newline at end of file diff --git a/prisma/migrations/20240618075438_squash_database_migrations_v_1_3_0/migration.sql b/prisma/migrations/20240618075438_squash_database_migrations_v_1_3_0/migration.sql new file mode 100644 index 0000000..41e3aa3 --- /dev/null +++ b/prisma/migrations/20240618075438_squash_database_migrations_v_1_3_0/migration.sql @@ -0,0 +1,313 @@ +-- CreateTable +CREATE TABLE `Publisher` ( + `id` VARCHAR(191) NOT NULL, + `firstName` VARCHAR(191) NOT NULL, + `lastName` VARCHAR(191) NOT NULL, + `email` VARCHAR(191) NOT NULL, + `phone` VARCHAR(191) NULL, + `isActive` BOOLEAN NOT NULL DEFAULT true, + `isImported` BOOLEAN NOT NULL DEFAULT false, + `isTrained` BOOLEAN NOT NULL DEFAULT false, + `age` INTEGER NULL, + `userId` VARCHAR(191) NULL, + `role` ENUM('ADMIN', 'POWERUSER', 'USER', 'EXTERNAL') NOT NULL DEFAULT 'USER', + `desiredShiftsPerMonth` INTEGER NOT NULL DEFAULT 4, + `isMale` BOOLEAN NOT NULL DEFAULT true, + `isNameForeign` BOOLEAN NOT NULL DEFAULT false, + `isSubscribedToCoverMe` BOOLEAN NOT NULL DEFAULT false, + `isSubscribedToReminders` BOOLEAN NOT NULL DEFAULT false, + `familyHeadId` VARCHAR(191) NULL, + `alwaysAsFamily` BOOLEAN NULL DEFAULT false, + `type` ENUM('Publisher', 'Bethelite', 'RegularPioneer', 'SpecialPioneer_Missionary') NOT NULL DEFAULT 'Publisher', + `town` VARCHAR(191) NULL, + `comments` VARCHAR(191) NULL, + `lastLogin` DATETIME(3) NULL, + `pushSubscription` JSON NULL, + `congregationId` INTEGER NULL, + `locale` VARCHAR(191) NULL DEFAULT 'bg', + + UNIQUE INDEX `Publisher_email_key`(`email`), + UNIQUE INDEX `Publisher_userId_key`(`userId`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- 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; + +-- CreateTable +CREATE TABLE `Availability` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `publisherId` VARCHAR(191) NOT NULL, + `name` VARCHAR(191) NOT NULL, + `dayofweek` ENUM('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday') NOT NULL, + `dayOfMonth` INTEGER NULL, + `weekOfMonth` INTEGER NULL, + `startTime` DATETIME(3) NOT NULL, + `endTime` DATETIME(3) NOT NULL, + `isActive` BOOLEAN NOT NULL DEFAULT true, + `type` ENUM('Weekly', 'Monthly', 'OneTime', 'PreviousAssignment', 'ReplacementOnly') NOT NULL DEFAULT 'Weekly', + `isWithTransportIn` BOOLEAN NOT NULL DEFAULT false, + `isWithTransportOut` BOOLEAN NOT NULL DEFAULT false, + `isFromPreviousAssignment` BOOLEAN NOT NULL DEFAULT false, + `isFromPreviousMonth` BOOLEAN NOT NULL DEFAULT false, + `repeatWeekly` BOOLEAN NULL, + `repeatFrequency` INTEGER NULL, + `endDate` DATETIME(3) NULL, + `dateOfEntry` DATETIME(3) NULL, + `parentAvailabilityId` INTEGER NULL, + + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `CartEvent` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `startTime` DATETIME(3) NOT NULL, + `endTime` DATETIME(3) NOT NULL, + `shiftDuration` INTEGER NOT NULL, + `dayofweek` ENUM('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday') NOT NULL, + `isActive` BOOLEAN NOT NULL DEFAULT true, + `locationId` INTEGER NOT NULL, + `eventType` ENUM('PW_Cart', 'KH_Cleaning') NOT NULL DEFAULT 'PW_Cart', + `numberOfPublishers` INTEGER NOT NULL DEFAULT 3, + + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `Shift` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `cartEventId` INTEGER NOT NULL, + `name` VARCHAR(191) NOT NULL, + `startTime` DATETIME(3) NOT NULL, + `endTime` DATETIME(3) NOT NULL, + `isActive` BOOLEAN NOT NULL DEFAULT true, + `requiresTransport` BOOLEAN NOT NULL DEFAULT false, + `notes` VARCHAR(191) NULL, + `reportId` INTEGER NULL, + `isPublished` BOOLEAN NOT NULL DEFAULT false, + + UNIQUE INDEX `Shift_reportId_key`(`reportId`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `Assignment` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `shiftId` INTEGER NOT NULL, + `publisherId` VARCHAR(191) NOT NULL, + `isBySystem` BOOLEAN NOT NULL DEFAULT false, + `isConfirmed` BOOLEAN NOT NULL DEFAULT false, + `isWithTransport` BOOLEAN NOT NULL DEFAULT false, + `isMailSent` BOOLEAN NOT NULL DEFAULT false, + `publicGuid` VARCHAR(191) NULL, + `originalPublisherId` VARCHAR(191) NULL, + + UNIQUE INDEX `Assignment_publicGuid_key`(`publicGuid`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `Location` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `name` VARCHAR(191) NOT NULL, + `address` VARCHAR(191) NOT NULL, + `isActive` BOOLEAN NOT NULL DEFAULT true, + `content` LONGTEXT NULL, + `picture1` VARCHAR(191) NULL, + `picture2` VARCHAR(191) NULL, + `picture3` VARCHAR(191) NULL, + `backupLocationId` INTEGER NULL, + + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `Report` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `date` DATETIME(3) NOT NULL, + `publisherId` VARCHAR(191) NOT NULL, + `locationId` INTEGER NULL, + `placementCount` INTEGER NULL, + `videoCount` INTEGER NULL, + `returnVisitInfoCount` INTEGER NULL, + `conversationCount` INTEGER NULL, + `experienceInfo` LONGTEXT NULL, + `type` ENUM('ServiceReport', 'Experience', 'Feedback_Problem', 'Feedback_Suggestion', 'Feedback') NOT NULL DEFAULT 'ServiceReport', + `comments` VARCHAR(191) NULL, + + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `Survey` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `content` VARCHAR(191) NOT NULL, + `answers` JSON NULL, + `publicFrom` DATETIME(3) NULL, + `publicUntil` DATETIME(3) NULL, + + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `Message` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `publisherId` VARCHAR(191) NOT NULL, + `date` DATETIME(3) NOT NULL, + `content` VARCHAR(191) NOT NULL, + `isRead` BOOLEAN NOT NULL DEFAULT false, + `isPublic` BOOLEAN NOT NULL DEFAULT false, + `type` ENUM('Email', 'SMS', 'Push', 'InApp') NOT NULL DEFAULT 'Email', + `publicUntil` DATETIME(3) NULL, + `shownDate` DATETIME(3) NULL, + `answer` VARCHAR(191) NULL, + `answerDate` DATETIME(3) NULL, + `surveyId` INTEGER NULL, + + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `EventLog` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `date` DATETIME(3) NOT NULL, + `publisherId` VARCHAR(191) NULL, + `shiftId` INTEGER NULL, + `content` VARCHAR(5000) NOT NULL, + `type` ENUM('AssignmentReplacementManual', 'AssignmentReplacementRequested', 'AssignmentReplacementAccepted', 'SentEmail', 'PasswordResetRequested', 'PasswordResetEmailConfirmed', 'PasswordResetCompleted') NOT NULL, + + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `User` ( + `id` VARCHAR(191) NOT NULL, + `name` VARCHAR(191) NULL, + `email` VARCHAR(191) NULL, + `emailVerifyToken` VARCHAR(191) NULL, + `emailVerified` DATETIME(3) NULL, + `image` VARCHAR(191) NULL, + `passwordHashLocalAccount` VARCHAR(191) NULL, + `publisherId` VARCHAR(191) NULL, + + UNIQUE INDEX `User_email_key`(`email`), + UNIQUE INDEX `User_publisherId_key`(`publisherId`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `Account` ( + `id` VARCHAR(191) NOT NULL, + `userId` VARCHAR(191) NOT NULL, + `type` VARCHAR(191) NOT NULL, + `provider` VARCHAR(191) NOT NULL, + `providerAccountId` VARCHAR(191) NOT NULL, + `refresh_token` VARCHAR(191) NULL, + `access_token` VARCHAR(191) NULL, + `expires_at` INTEGER NULL, + `token_type` VARCHAR(191) NULL, + `scope` VARCHAR(191) NULL, + `id_token` VARCHAR(191) NULL, + `session_state` VARCHAR(191) NULL, + + UNIQUE INDEX `Account_provider_providerAccountId_key`(`provider`, `providerAccountId`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `Session` ( + `id` VARCHAR(191) NOT NULL, + `sessionToken` VARCHAR(191) NOT NULL, + `userId` VARCHAR(191) NOT NULL, + `expires` DATETIME(3) NOT NULL, + + UNIQUE INDEX `Session_sessionToken_key`(`sessionToken`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `VerificationToken` ( + `identifier` VARCHAR(191) NOT NULL, + `token` VARCHAR(191) NOT NULL, + `expires` DATETIME(3) NOT NULL, + + UNIQUE INDEX `VerificationToken_token_key`(`token`), + UNIQUE INDEX `VerificationToken_identifier_token_key`(`identifier`, `token`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `Settings` ( + `key` VARCHAR(191) NOT NULL, + `value` VARCHAR(191) NOT NULL, + `description` VARCHAR(191) NULL, + + PRIMARY KEY (`key`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- AddForeignKey +ALTER TABLE `Publisher` ADD CONSTRAINT `Publisher_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Publisher` ADD CONSTRAINT `Publisher_familyHeadId_fkey` FOREIGN KEY (`familyHeadId`) REFERENCES `Publisher`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; + +-- 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 `Availability` ADD CONSTRAINT `Availability_publisherId_fkey` FOREIGN KEY (`publisherId`) REFERENCES `Publisher`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Availability` ADD CONSTRAINT `Availability_parentAvailabilityId_fkey` FOREIGN KEY (`parentAvailabilityId`) REFERENCES `Availability`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `CartEvent` ADD CONSTRAINT `CartEvent_locationId_fkey` FOREIGN KEY (`locationId`) REFERENCES `Location`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Shift` ADD CONSTRAINT `Shift_cartEventId_fkey` FOREIGN KEY (`cartEventId`) REFERENCES `CartEvent`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Shift` ADD CONSTRAINT `Shift_reportId_fkey` FOREIGN KEY (`reportId`) REFERENCES `Report`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Assignment` ADD CONSTRAINT `Assignment_shiftId_fkey` FOREIGN KEY (`shiftId`) REFERENCES `Shift`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Assignment` ADD CONSTRAINT `Assignment_publisherId_fkey` FOREIGN KEY (`publisherId`) REFERENCES `Publisher`(`id`) ON DELETE CASCADE 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; + +-- AddForeignKey +ALTER TABLE `Location` ADD CONSTRAINT `Location_backupLocationId_fkey` FOREIGN KEY (`backupLocationId`) REFERENCES `Location`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Report` ADD CONSTRAINT `Report_publisherId_fkey` FOREIGN KEY (`publisherId`) REFERENCES `Publisher`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Report` ADD CONSTRAINT `Report_locationId_fkey` FOREIGN KEY (`locationId`) REFERENCES `Location`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Message` ADD CONSTRAINT `Message_publisherId_fkey` FOREIGN KEY (`publisherId`) REFERENCES `Publisher`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Message` ADD CONSTRAINT `Message_surveyId_fkey` FOREIGN KEY (`surveyId`) REFERENCES `Survey`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- 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; + +-- AddForeignKey +ALTER TABLE `Account` ADD CONSTRAINT `Account_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `Session` ADD CONSTRAINT `Session_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;