fix migrations

This commit is contained in:
Dobromir Popov
2024-06-17 22:42:37 +03:00
parent 905ea86329
commit 92447348cb
2 changed files with 11 additions and 7 deletions

View File

@ -1,5 +1,6 @@
-- AlterTable
ALTER TABLE `message` ADD COLUMN `answer` VARCHAR(191) NULL,
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;
@ -12,8 +13,10 @@ CREATE TABLE `Survey` (
`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 SET NULL ON UPDATE CASCADE;
ALTER TABLE `Message`
ADD CONSTRAINT `Message_surveyId_fkey` FOREIGN KEY (`surveyId`) REFERENCES `Survey` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

View File

@ -1,5 +1,6 @@
-- DropForeignKey
ALTER TABLE `message` DROP FOREIGN KEY `Message_surveyId_fkey`;
ALTER TABLE `Message` DROP FOREIGN KEY `Message_surveyId_fkey`;
-- AddForeignKey
ALTER TABLE `Message` ADD CONSTRAINT `Message_surveyId_fkey` FOREIGN KEY (`surveyId`) REFERENCES `Survey`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `Message`
ADD CONSTRAINT `Message_surveyId_fkey` FOREIGN KEY (`surveyId`) REFERENCES `Survey` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;