Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

desktop: register natural_key SQLite function

kashaf-ansari-dev5c74a4fd9fba
diff --git a/apps/desktop/src/api/sqlite-kysely.ts b/apps/desktop/src/api/sqlite-kysely.ts
index 8b2625d18..3b70eeaf5 100644
--- a/apps/desktop/src/api/sqlite-kysely.ts
+++ b/apps/desktop/src/api/sqlite-kysely.ts
@@ -58,6 +58,9 @@ class SQLite {
this.sqlite = require("better-sqlite3-multiple-ciphers")(
this.filePath
).unsafeMode(true);
+ this.sqlite.function("natural_key", (str: string | null) =>
+ str ? str.replace(/\d+/g, (n) => n.padStart(10, "0")) : ""
+ );
}
/**