/*
  Warnings:

  - You are about to drop the column `role` on the `Token` table. All the data in the column will be lost.
  - You are about to alter the column `status` on the `Token` table. The data in that column could be lost. The data in that column will be cast from `TinyInt` to `Enum(EnumId(7))`.
  - A unique constraint covering the columns `[userId]` on the table `Token` will be added. If there are existing duplicate values, this will fail.
  - Added the required column `userId` to the `Token` table without a default value. This is not possible if the table is not empty.

*/
-- AlterTable
ALTER TABLE `Token` DROP COLUMN `role`,
    ADD COLUMN `userId` INTEGER NOT NULL,
    MODIFY `status` ENUM('EXPIRED', 'ACTIVE') NOT NULL;

-- CreateIndex
CREATE UNIQUE INDEX `Token_userId_key` ON `Token`(`userId`);

-- AddForeignKey
ALTER TABLE `Token` ADD CONSTRAINT `Token_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
