-- DropForeignKey
ALTER TABLE `Service` DROP FOREIGN KEY `Service_parlourId_fkey`;

-- DropIndex
DROP INDEX `Service_parlourId_fkey` ON `Service`;

-- AlterTable
ALTER TABLE `Service` ADD COLUMN `catId` INTEGER NULL,
    ADD COLUMN `imageId` INTEGER NULL,
    ADD COLUMN `initialPayment` DECIMAL(65, 30) NULL,
    ADD COLUMN `salePrice` DECIMAL(65, 30) NULL,
    ADD COLUMN `subcatId` INTEGER NULL,
    ADD COLUMN `translations` JSON NULL;

-- CreateTable
CREATE TABLE `ServiceGallery` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `serviceId` INTEGER NOT NULL,
    `imageId` INTEGER NOT NULL,

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

-- CreateTable
CREATE TABLE `ServiceVariation` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `serviceId` INTEGER NOT NULL,
    `name` VARCHAR(191) NOT NULL,
    `description` VARCHAR(191) NULL,
    `translations` JSON NULL,
    `price` DECIMAL(65, 30) NOT NULL,

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

-- CreateTable
CREATE TABLE `ServiceSpecialist` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `serviceId` INTEGER NOT NULL,
    `staffId` INTEGER NOT NULL,

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

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

-- AddForeignKey
ALTER TABLE `Service` ADD CONSTRAINT `Service_catId_fkey` FOREIGN KEY (`catId`) REFERENCES `Category`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `Service` ADD CONSTRAINT `Service_subcatId_fkey` FOREIGN KEY (`subcatId`) REFERENCES `SubCategory`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `ServiceGallery` ADD CONSTRAINT `ServiceGallery_serviceId_fkey` FOREIGN KEY (`serviceId`) REFERENCES `Service`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `ServiceVariation` ADD CONSTRAINT `ServiceVariation_serviceId_fkey` FOREIGN KEY (`serviceId`) REFERENCES `Service`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `ServiceSpecialist` ADD CONSTRAINT `ServiceSpecialist_serviceId_fkey` FOREIGN KEY (`serviceId`) REFERENCES `Service`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `ServiceSpecialist` ADD CONSTRAINT `ServiceSpecialist_staffId_fkey` FOREIGN KEY (`staffId`) REFERENCES `Staff`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
