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