Skip to content
Source
Sign inSign up
TanStack/db

fix(sqlite-persistence): accept Tauri string migration errors #1900

MergedKyleAMathews(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/1900/headmerged by KyleAMathews(GitHub profile, opens in a new tab)

Showing 3 changed files with 188 additions and 7 deletions.

x
0 of 3 viewed, 3 left
6 additions and 0 deletions.changeset/fix-tauri-string-migration-errors.mdAdded
View file
@@ -0,0 +1,6 @@
+---
+'@tanstack/db-sqlite-persistence-core': patch
+'@tanstack/tauri-db-sqlite-persistence': patch
+---
+​
+Allow idempotent SQLite column migrations to recognize Tauri SQL duplicate-column errors returned as strings while continuing to reject unrelated migration failures.
7 additions and 7 deletionspackages/db-sqlite-persistence-core/src/sqlite-core-adapter.tsModified
View file
@@ -121,17 +121,17 @@
error: unknown,
columnName: string,
): boolean {
- if (!(error instanceof Error)) {
+ if (typeof error !== `string` && !(error instanceof Error)) {
return false
​
- const message = error.message.toLowerCase()
- const normalizedColumnName = columnName.toLowerCase()
+ const normalizedMessage = (
+ typeof error === `string` ? error : error.message
+ ).toLowerCase()
return (
- (message.includes(`duplicate column name`) &&