From 2cb1b28a114185b6f097d6e389375e3f6112f953 Mon Sep 17 00:00:00 2001
From: Gavin Mogan <github@gavinmogan.com>
Date: Tue, 9 Sep 2025 00:28:48 -0700
Subject: fix: fix migration failing when no user settings are set. fixes #1919
 (#1920)

---
 packages/db/drizzle/0061_merge_user_settings.sql | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'packages/db/drizzle/0061_merge_user_settings.sql')

diff --git a/packages/db/drizzle/0061_merge_user_settings.sql b/packages/db/drizzle/0061_merge_user_settings.sql
index 46c11739..7a12ef60 100644
--- a/packages/db/drizzle/0061_merge_user_settings.sql
+++ b/packages/db/drizzle/0061_merge_user_settings.sql
@@ -2,13 +2,13 @@ ALTER TABLE `user` ADD `bookmarkClickAction` text DEFAULT 'open_original_link' N
 ALTER TABLE `user` ADD `archiveDisplayBehaviour` text DEFAULT 'show' NOT NULL;--> statement-breakpoint
 ALTER TABLE `user` ADD `timezone` text DEFAULT 'UTC';--> statement-breakpoint
 UPDATE `user` SET
-  `bookmarkClickAction` = (
+  `bookmarkClickAction` = coalesce((
     SELECT `bookmarkClickAction` FROM `userSettings` WHERE `userSettings`.`userId` = `user`.`id`
-  ),
-  `archiveDisplayBehaviour` = (
+  ), 'open_original_link'),
+  `archiveDisplayBehaviour` = coalesce((
     SELECT `archiveDisplayBehaviour` FROM `userSettings` WHERE `userSettings`.`userId` = `user`.`id`
-  ),
-  `timezone` = (
+  ), 'show'),
+  `timezone` = coalesce((
     SELECT `timezone` FROM `userSettings` WHERE `userSettings`.`userId` = `user`.`id`
-  );--> statement-breakpoint
+  ), 'UTC');--> statement-breakpoint
 DROP TABLE `userSettings`;
-- 
cgit v1.2.3-70-g09d2

