From 2adb8e38074c0555be50ffad120fdf7a4b8be1fd Mon Sep 17 00:00:00 2001 From: fuomag9 <1580624+fuomag9@users.noreply.github.com> Date: Mon, 13 Apr 2026 06:46:02 +0200 Subject: [PATCH] Fix migration crash when linking_tokens table does not exist Some deployments never ran migration 0007 that created the linking_tokens table. The camelCase rename migration (0021) now creates the table with old column names if missing before renaming. Co-Authored-By: Claude Opus 4.6 (1M context) --- drizzle/0021_camelcase_columns.sql | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drizzle/0021_camelcase_columns.sql b/drizzle/0021_camelcase_columns.sql index a0be20af..090141a8 100644 --- a/drizzle/0021_camelcase_columns.sql +++ b/drizzle/0021_camelcase_columns.sql @@ -106,7 +106,13 @@ ALTER TABLE "audit_events" RENAME COLUMN "entity_type" TO "entityType";--> state ALTER TABLE "audit_events" RENAME COLUMN "entity_id" TO "entityId";--> statement-breakpoint ALTER TABLE "audit_events" RENAME COLUMN "created_at" TO "createdAt";--> statement-breakpoint --- linking_tokens +-- linking_tokens (create with old column names if missing — some deployments never ran migration 0007) +CREATE TABLE IF NOT EXISTS "linking_tokens" ( + "id" text PRIMARY KEY NOT NULL, + "token" text NOT NULL, + "created_at" text NOT NULL, + "expires_at" text NOT NULL +);--> statement-breakpoint ALTER TABLE "linking_tokens" RENAME COLUMN "created_at" TO "createdAt";--> statement-breakpoint ALTER TABLE "linking_tokens" RENAME COLUMN "expires_at" TO "expiresAt";--> statement-breakpoint