From 2a808f8ca1ec40a666e21c6bb14f20c9302e6821 Mon Sep 17 00:00:00 2001 From: Dmytro Stanchiev Date: Mon, 6 Apr 2026 23:16:58 -0400 Subject: [PATCH] fix(db): preserve OAuth user verified status during migration Update emailVerified type conversion to set OAuth users (those with account records) as verified before converting timestamp to boolean. --- drizzle/0001_great_sentry.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drizzle/0001_great_sentry.sql b/drizzle/0001_great_sentry.sql index 1a0bf22..48b7536 100644 --- a/drizzle/0001_great_sentry.sql +++ b/drizzle/0001_great_sentry.sql @@ -13,6 +13,8 @@ ALTER TABLE "account" RENAME COLUMN "expires_at" TO "accessTokenExpiresAt";--> s ALTER TABLE "account" RENAME COLUMN "id_token" TO "idToken";--> statement-breakpoint ALTER TABLE "verification" DROP CONSTRAINT "verificationToken_identifier_token_pk";--> statement-breakpoint ALTER TABLE "account" DROP CONSTRAINT "account_provider_providerAccountId_pk";--> statement-breakpoint +-- Mark OAuth users as verified before type conversion +UPDATE "user" SET "emailVerified" = NOW() WHERE "emailVerified" IS NULL AND id IN (SELECT "userId" FROM account); ALTER TABLE "user" ALTER COLUMN "emailVerified" SET DATA TYPE boolean USING ("emailVerified" IS NOT NULL);--> statement-breakpoint ALTER TABLE "session" DROP CONSTRAINT "session_pkey";--> statement-breakpoint ALTER TABLE "session" ADD COLUMN "id" text PRIMARY KEY NOT NULL DEFAULT gen_random_uuid();--> statement-breakpoint