/*
  Warnings:

  - You are about to drop the column `admin_account_id` on the `accounts` table. All the data in the column will be lost.
  - You are about to drop the column `consumer_account_id` on the `accounts` table. All the data in the column will be lost.
  - You are about to drop the column `partner_account_id` on the `accounts` table. All the data in the column will be lost.
  - You are about to drop the column `provider_account_id` on the `accounts` table. All the data in the column will be lost.
  - A unique constraint covering the columns `[account_id]` on the table `admin_accounts` will be added. If there are existing duplicate values, this will fail.
  - A unique constraint covering the columns `[account_id]` on the table `consumer_accounts` will be added. If there are existing duplicate values, this will fail.
  - A unique constraint covering the columns `[account_id]` on the table `partner_accounts` will be added. If there are existing duplicate values, this will fail.
  - A unique constraint covering the columns `[account_id]` on the table `provider_accounts` will be added. If there are existing duplicate values, this will fail.
  - Added the required column `account_id` to the `admin_accounts` table without a default value. This is not possible if the table is not empty.
  - Added the required column `account_id` to the `consumer_accounts` table without a default value. This is not possible if the table is not empty.
  - Added the required column `account_id` to the `partner_accounts` table without a default value. This is not possible if the table is not empty.
  - Added the required column `account_id` to the `provider_accounts` table without a default value. This is not possible if the table is not empty.

*/
-- DropForeignKey
ALTER TABLE `accounts` DROP FOREIGN KEY `accounts_admin_account_id_fkey`;

-- DropForeignKey
ALTER TABLE `accounts` DROP FOREIGN KEY `accounts_consumer_account_id_fkey`;

-- DropForeignKey
ALTER TABLE `accounts` DROP FOREIGN KEY `accounts_partner_account_id_fkey`;

-- DropForeignKey
ALTER TABLE `accounts` DROP FOREIGN KEY `accounts_provider_account_id_fkey`;

-- DropIndex
DROP INDEX `accounts_admin_account_id_fkey` ON `accounts`;

-- DropIndex
DROP INDEX `accounts_consumer_account_id_fkey` ON `accounts`;

-- DropIndex
DROP INDEX `accounts_partner_account_id_fkey` ON `accounts`;

-- DropIndex
DROP INDEX `accounts_provider_account_id_fkey` ON `accounts`;

-- AlterTable
ALTER TABLE `accounts` DROP COLUMN `admin_account_id`,
    DROP COLUMN `consumer_account_id`,
    DROP COLUMN `partner_account_id`,
    DROP COLUMN `provider_account_id`;

-- AlterTable
ALTER TABLE `admin_accounts` ADD COLUMN `account_id` VARCHAR(191) NOT NULL;

-- AlterTable
ALTER TABLE `consumer_accounts` ADD COLUMN `account_id` VARCHAR(191) NOT NULL,
    MODIFY `role` ENUM('OWNER', 'MANAGER', 'OPERATOR') NOT NULL;

-- AlterTable
ALTER TABLE `partner_accounts` ADD COLUMN `account_id` VARCHAR(191) NOT NULL,
    MODIFY `role` ENUM('OWNER', 'MANAGER', 'OPERATOR') NOT NULL;

-- AlterTable
ALTER TABLE `provider_accounts` ADD COLUMN `account_id` VARCHAR(191) NOT NULL,
    MODIFY `role` ENUM('OWNER', 'MANAGER', 'OPERATOR') NOT NULL;

-- CreateIndex
CREATE UNIQUE INDEX `admin_accounts_account_id_key` ON `admin_accounts`(`account_id`);

-- CreateIndex
CREATE UNIQUE INDEX `consumer_accounts_account_id_key` ON `consumer_accounts`(`account_id`);

-- CreateIndex
CREATE UNIQUE INDEX `partner_accounts_account_id_key` ON `partner_accounts`(`account_id`);

-- CreateIndex
CREATE UNIQUE INDEX `provider_accounts_account_id_key` ON `provider_accounts`(`account_id`);

-- AddForeignKey
ALTER TABLE `admin_accounts` ADD CONSTRAINT `admin_accounts_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `consumer_accounts` ADD CONSTRAINT `consumer_accounts_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `partner_accounts` ADD CONSTRAINT `partner_accounts_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `provider_accounts` ADD CONSTRAINT `provider_accounts_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
