-- CreateTable
CREATE TABLE `subscriber_mail_queue` (
    `smq_id` INTEGER NOT NULL AUTO_INCREMENT,
    `smq_subject` VARCHAR(191) NOT NULL,
    `smq_content` VARCHAR(191) NOT NULL,
    `smq_status` VARCHAR(191) NOT NULL DEFAULT 'pending',
    `smq_date` INTEGER NOT NULL DEFAULT 0,
    `smq_sent_date` INTEGER NOT NULL DEFAULT 0,

    PRIMARY KEY (`smq_id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `subscriber_mail_recipient` (
    `smr_id` INTEGER NOT NULL AUTO_INCREMENT,
    `smr_smq_id` INTEGER NOT NULL,
    `smr_ss_id` INTEGER NOT NULL,
    `smr_email` VARCHAR(191) NOT NULL,
    `smr_status` VARCHAR(191) NOT NULL DEFAULT 'pending',
    `smr_error` VARCHAR(191) NULL,
    `smr_sent_date` INTEGER NOT NULL DEFAULT 0,

    PRIMARY KEY (`smr_id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- AddForeignKey
ALTER TABLE `subscriber_mail_recipient` ADD CONSTRAINT `subscriber_mail_recipient_smr_smq_id_fkey` FOREIGN KEY (`smr_smq_id`) REFERENCES `subscriber_mail_queue`(`smq_id`) ON DELETE RESTRICT ON UPDATE CASCADE;
