-- AlterTable
ALTER TABLE `Vente` ADD COLUMN `modePaymentId` INTEGER NULL;

-- CreateTable
CREATE TABLE `ModePayment` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `code` ENUM('WAVE', 'ORANGE_MONEY', 'CASH', 'FREE_MONEY') NOT NULL,
    `libelle` VARCHAR(50) NOT NULL,

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

-- CreateTable
CREATE TABLE `FastFoodModePayment` (
    `modePaymentId` INTEGER NOT NULL,
    `fastFoodId` INTEGER NOT NULL,

    PRIMARY KEY (`fastFoodId`, `modePaymentId`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- AddForeignKey
ALTER TABLE `Vente` ADD CONSTRAINT `Vente_modePaymentId_fkey` FOREIGN KEY (`modePaymentId`) REFERENCES `ModePayment`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `FastFoodModePayment` ADD CONSTRAINT `FastFoodModePayment_modePaymentId_fkey` FOREIGN KEY (`modePaymentId`) REFERENCES `ModePayment`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `FastFoodModePayment` ADD CONSTRAINT `FastFoodModePayment_fastFoodId_fkey` FOREIGN KEY (`fastFoodId`) REFERENCES `FastFood`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
