/*
  Warnings:

  - You are about to drop the column `image` on the `Admin` table. All the data in the column will be lost.
  - You are about to drop the column `imageUrl` on the `Parlour` table. All the data in the column will be lost.
  - You are about to drop the column `image` on the `Staff` table. All the data in the column will be lost.
  - A unique constraint covering the columns `[imageId]` on the table `Admin` will be added. If there are existing duplicate values, this will fail.
  - A unique constraint covering the columns `[imageId]` on the table `Parlour` will be added. If there are existing duplicate values, this will fail.
  - A unique constraint covering the columns `[imageId]` on the table `Staff` will be added. If there are existing duplicate values, this will fail.

*/
-- AlterTable
ALTER TABLE `Admin` DROP COLUMN `image`,
    ADD COLUMN `imageId` INTEGER NULL;

-- AlterTable
ALTER TABLE `Parlour` DROP COLUMN `imageUrl`,
    ADD COLUMN `imageId` INTEGER NULL;

-- AlterTable
ALTER TABLE `Staff` DROP COLUMN `image`,
    ADD COLUMN `imageId` INTEGER NULL;

-- CreateIndex
CREATE UNIQUE INDEX `Admin_imageId_key` ON `Admin`(`imageId`);

-- CreateIndex
CREATE UNIQUE INDEX `Parlour_imageId_key` ON `Parlour`(`imageId`);

-- CreateIndex
CREATE UNIQUE INDEX `Staff_imageId_key` ON `Staff`(`imageId`);

-- AddForeignKey
ALTER TABLE `Parlour` ADD CONSTRAINT `Parlour_imageId_fkey` FOREIGN KEY (`imageId`) REFERENCES `Media`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `Admin` ADD CONSTRAINT `Admin_imageId_fkey` FOREIGN KEY (`imageId`) REFERENCES `Media`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `Staff` ADD CONSTRAINT `Staff_imageId_fkey` FOREIGN KEY (`imageId`) REFERENCES `Media`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
