Files
mwitnessing/prisma/migrations/20240112104657_adding_assignment_guids/migration.sql
2024-02-22 04:19:38 +02:00

33 lines
1.3 KiB
SQL

/*
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;