ALTER TABLE `woc_users`
  ADD COLUMN `emailVerifiedAt` DATETIME(3) NULL;

UPDATE `woc_users`
SET `emailVerifiedAt` = COALESCE(`emailVerifiedAt`, NOW(3));

CREATE TABLE `woc_email_verification_tokens` (
  `id` VARCHAR(191) NOT NULL,
  `userId` VARCHAR(191) NOT NULL,
  `tokenHash` VARCHAR(191) NOT NULL,
  `expiresAt` DATETIME(3) NOT NULL,
  `usedAt` DATETIME(3) NULL,
  `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),

  UNIQUE INDEX `woc_email_verification_tokens_tokenHash_key`(`tokenHash`),
  INDEX `woc_email_verification_tokens_userId_idx`(`userId`),
  PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

ALTER TABLE `woc_email_verification_tokens`
  ADD CONSTRAINT `woc_email_verification_tokens_userId_fkey`
  FOREIGN KEY (`userId`) REFERENCES `woc_users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
