-- CreateTable
CREATE TABLE `CustomerParlour` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `customerId` INTEGER NOT NULL,
    `parlourId` INTEGER NOT NULL,
    `isPrimary` BOOLEAN NOT NULL DEFAULT false,
    `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    `updatedAt` DATETIME(3) NOT NULL,

    INDEX `CustomerParlour_parlourId_idx`(`parlourId`),
    INDEX `CustomerParlour_customerId_idx`(`customerId`),
    UNIQUE INDEX `CustomerParlour_customerId_parlourId_key`(`customerId`, `parlourId`),
    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- AddForeignKey
ALTER TABLE `CustomerParlour` ADD CONSTRAINT `CustomerParlour_customerId_fkey` FOREIGN KEY (`customerId`) REFERENCES `Customer`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `CustomerParlour` ADD CONSTRAINT `CustomerParlour_parlourId_fkey` FOREIGN KEY (`parlourId`) REFERENCES `Parlour`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
