/*
  Warnings:

  - A unique constraint covering the columns `[token]` on the table `employees` will be added. If there are existing duplicate values, this will fail.
  - Added the required column `email` to the `employees` table without a default value. This is not possible if the table is not empty.
  - Added the required column `name` to the `employees` table without a default value. This is not possible if the table is not empty.
  - Added the required column `updatedAt` to the `employees` table without a default value. This is not possible if the table is not empty.

*/
-- DropForeignKey
ALTER TABLE `employees` DROP FOREIGN KEY `employees_userId_fkey`;

-- AlterTable
ALTER TABLE `employees` ADD COLUMN `email` VARCHAR(191) NOT NULL,
    ADD COLUMN `expiresAt` DATETIME(3) NULL,
    ADD COLUMN `invitedByUserId` VARCHAR(191) NULL,
    ADD COLUMN `name` VARCHAR(191) NOT NULL,
    ADD COLUMN `role` ENUM('SUPER_ADMIN', 'ADMIN', 'MANAGER', 'EMPLOYEE', 'CLIENT', 'PARTNER') NOT NULL DEFAULT 'EMPLOYEE',
    ADD COLUMN `status` ENUM('INVITED', 'ACTIVE', 'SUSPENDED', 'REVOKED') NOT NULL DEFAULT 'INVITED',
    ADD COLUMN `token` VARCHAR(191) NULL,
    ADD COLUMN `updatedAt` DATETIME(3) NOT NULL,
    MODIFY `userId` VARCHAR(191) NULL;

-- CreateIndex
CREATE UNIQUE INDEX `employees_token_key` ON `employees`(`token`);

-- CreateIndex
CREATE INDEX `employees_email_idx` ON `employees`(`email`);

-- CreateIndex
CREATE INDEX `employees_token_idx` ON `employees`(`token`);

-- AddForeignKey
ALTER TABLE `employees` ADD CONSTRAINT `employees_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
