/*
  Warnings:

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

*/
-- DropForeignKey
ALTER TABLE `clients` DROP FOREIGN KEY `clients_userId_fkey`;

-- AlterTable
ALTER TABLE `clients` ADD COLUMN `email` VARCHAR(191) NOT NULL,
    ADD COLUMN `expiresAt` DATETIME(3) NULL,
    ADD COLUMN `name` VARCHAR(191) NOT NULL,
    ADD COLUMN `phone` VARCHAR(191) NULL,
    ADD COLUMN `status` ENUM('INVITED', 'ACTIVE', 'SUSPENDED', 'REVOKED') NOT NULL DEFAULT 'INVITED',
    ADD COLUMN `token` VARCHAR(191) NULL,
    MODIFY `userId` VARCHAR(191) NULL;

-- CreateIndex
CREATE UNIQUE INDEX `clients_token_key` ON `clients`(`token`);

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