-- CreateTable
CREATE TABLE `user_favorite_training_modules` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `user_id` INTEGER NOT NULL,
    `training_module_id` INTEGER NOT NULL,
    `created_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),

    INDEX `user_favorite_training_modules_user_id_idx`(`user_id`),
    INDEX `user_favorite_training_modules_training_module_id_idx`(`training_module_id`),
    UNIQUE INDEX `user_favorite_training_modules_user_id_training_module_id_key`(`user_id`, `training_module_id`),
    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- AddForeignKey
ALTER TABLE `user_favorite_training_modules` ADD CONSTRAINT `user_favorite_training_modules_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `user_favorite_training_modules` ADD CONSTRAINT `user_favorite_training_modules_training_module_id_fkey` FOREIGN KEY (`training_module_id`) REFERENCES `training_modules`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
