From 22b36f1259e7bc6cd2851178df050340559d717c Mon Sep 17 00:00:00 2001 From: Joey Yakimowich-Payne Date: Thu, 22 Jan 2026 08:08:50 -0700 Subject: [PATCH] Fix fk --- server/src/db/connection.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/src/db/connection.ts b/server/src/db/connection.ts index 1dd8805..40b2e16 100644 --- a/server/src/db/connection.ts +++ b/server/src/db/connection.ts @@ -93,6 +93,8 @@ const runMigrations = () => { )) .join(', '); + // Disable foreign key checks while rebuilding the users table. + db.exec('PRAGMA foreign_keys = OFF'); db.exec('BEGIN'); db.exec('ALTER TABLE users RENAME TO users_old'); db.exec(` @@ -107,6 +109,7 @@ const runMigrations = () => { `); db.exec('DROP TABLE users_old'); db.exec('COMMIT'); + db.exec('PRAGMA foreign_keys = ON'); userTableInfo2 = db.prepare("PRAGMA table_info(users)").all() as { name: string }[]; } if (didDropApiKeyColumns) {