-- AlterTable
ALTER TABLE `notifications` MODIFY `type` ENUM('LIKE', 'MESSAGE', 'TAG', 'QUOTE_RECEIVED', 'COMMENT') NOT NULL;

-- CreateTable
CREATE TABLE `confession_comments` (
    `id` VARCHAR(191) NOT NULL,
    `confessionId` VARCHAR(191) NOT NULL,
    `userId` VARCHAR(191) NOT NULL,
    `parentId` VARCHAR(191) NULL,
    `body` TEXT NOT NULL,
    `isActive` BOOLEAN NOT NULL DEFAULT true,
    `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),

    INDEX `confession_comments_confessionId_createdAt_idx`(`confessionId`, `createdAt`),
    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- AddForeignKey
ALTER TABLE `confession_comments` ADD CONSTRAINT `confession_comments_confessionId_fkey` FOREIGN KEY (`confessionId`) REFERENCES `confessions`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `confession_comments` ADD CONSTRAINT `confession_comments_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `confession_comments` ADD CONSTRAINT `confession_comments_parentId_fkey` FOREIGN KEY (`parentId`) REFERENCES `confession_comments`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
