zadam / trilium

Build your personal knowledge base with Trilium Notes
GNU Affero General Public License v3.0
27.2k stars 1.9k forks source link

(Bug report) I use new version 0.57.5 to open an db file (version 0.49.5),it can't work. #3447

Closed sdlytcl closed 1 year ago

sdlytcl commented 1 year ago

Trilium Version

0.57.5

What operating system are you using?

Windows

What is your setup?

Local (no sync)

Operating System Version

win10

Description

I use new version 0.57.5 to open an db file (version 0.49.5),it can't work.

Error logs

D:\田的软件\trilium-windows-x64-0.57.5\trilium-windows-x64> App db version is 197, while db version is 189. Migration needed. DB size: 25964 KB Trusted reverse proxy: false App HTTP server starting up at port 37840 { "appVersion": "0.57.5", "dbVersion": 197, "syncVersion": 26, "buildDate": "2022-12-13T23:08:52+01:00", "buildRevision": "921f75beba6ac71d767f6b723692c73c1cd5f70e", "dataDirectory": "C:\Users\鐢版槬鍒‐\AppData\Roaming\trilium-data", "clipperProtocolVersion": "1.0", "utcDateTime": "2022-12-22T08:19:06.583Z" } CPU model: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz, logical cores: 8 freq: 2419 Mhz Listening on port 37840 Created backup at C:\Users\鐢版槬鍒‐AppData\Roaming\trilium-data\backup/backup-before-migration.db Attempting migration to version 190 Migration with SQL script: CREATE TABLE IF NOT EXISTS "etapi_tokens" ( etapiTokenId TEXT PRIMARY KEY NOT NULL, name TEXT NOT NULL, tokenHash TEXT NOT NULL, utcDateCreated TEXT NOT NULL, utcDateModified TEXT NOT NULL, isDeleted INT NOT NULL DEFAULT 0);

INSERT INTO etapi_tokens (etapiTokenId, name, tokenHash, utcDateCreated, utcDateModified, isDeleted) SELECT apiTokenId, 'Trilium Sender', token, utcDateCreated, utcDateCreated, isDeleted FROM api_tokens;

DROP TABLE api_tokens;

UPDATE entity_changes SET entityName = 'etapi_tokens' WHERE entityName = 'api_tokens';

Migration to version 190 has been successful. Attempting migration to version 191 Migration with JS module Migration to version 191 has been successful. Attempting migration to version 192 Migration with SQL script: CREATE TABLE IF NOT EXISTS "mig_entity_changes" ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, entityName TEXT NOT NULL, entityId TEXT NOT NULL, hash TEXT NOT NULL, isErased INT NOT NULL, changeId TEXT NOT NULL, componentId TEXT NOT NULL, instanceId TEXT NOT NULL, isSynced INTEGER NOT NULL, utcDateChanged TEXT NOT NULL );

INSERT INTO mig_entity_changes (id, entityName, entityId, hash, isErased, changeId, componentId, instanceId, isSynced, utcDateChanged) SELECT id, entityName, entityId, hash, isErased, changeId, '', '', isSynced, utcDateChanged FROM entity_changes;

DROP TABLE entity_changes;

ALTER TABLE mig_entity_changes RENAME TO entity_changes;

CREATE UNIQUE INDEX IDX_entityChanges_entityName_entityId ON "entity_changes" ( entityName, entityId );

ERROR: error during migration to version 192: SqliteError: UNIQUE constraint failed: mig_entity_changes.id at Database.exec (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\node_modules\better-sqlite3\lib\methods\wrappers.js:9:14) at Object.executeScript (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\sql.js:194:25) at Function. (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:16:17) at Function.sqliteTransaction (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\node_modules\better-sqlite3\lib\methods\transaction.js:65:24) at Object.transactional (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\sql.js:236:52) at executeMigration (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:10:9) at migrate (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:71:13) at async Object.migrateIfNecessary (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:112:9) at async initDbConnection (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\sql_init.js:41:5) ERROR: migration failed, crashing hard Attempting migration to version 193 ERROR: error during migration to version 193: TypeError: The database connection is not open at Function.sqliteTransaction (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\node_modules\better-sqlite3\lib\methods\transaction.js:63:9) at Object.transactional (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\sql.js:236:52) at executeMigration (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:10:9) at migrate (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:71:13) at async Object.migrateIfNecessary (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:112:9) at async initDbConnection (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\sql_init.js:41:5) ERROR: migration failed, crashing hard Attempting migration to version 194 ERROR: error during migration to version 194: TypeError: The database connection is not open at Function.sqliteTransaction (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\node_modules\better-sqlite3\lib\methods\transaction.js:63:9) at Object.transactional (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\sql.js:236:52) at executeMigration (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:10:9) at migrate (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:71:13) at async Object.migrateIfNecessary (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:112:9) at async initDbConnection (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\sql_init.js:41:5) ERROR: migration failed, crashing hard Attempting migration to version 195 ERROR: error during migration to version 195: TypeError: The database connection is not open at Function.sqliteTransaction (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\node_modules\better-sqlite3\lib\methods\transaction.js:63:9) at Object.transactional (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\sql.js:236:52) at executeMigration (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:10:9) at migrate (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:71:13) at async Object.migrateIfNecessary (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:112:9) at async initDbConnection (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\sql_init.js:41:5) ERROR: migration failed, crashing hard Attempting migration to version 196 ERROR: error during migration to version 196: TypeError: The database connection is not open at Function.sqliteTransaction (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\node_modules\better-sqlite3\lib\methods\transaction.js:63:9) at Object.transactional (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\sql.js:236:52) at executeMigration (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:10:9) at migrate (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:71:13) at async Object.migrateIfNecessary (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:112:9) at async initDbConnection (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\sql_init.js:41:5) ERROR: migration failed, crashing hard Attempting migration to version 197 ERROR: error during migration to version 197: TypeError: The database connection is not open at Function.sqliteTransaction (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\node_modules\better-sqlite3\lib\methods\transaction.js:63:9) at Object.transactional (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\sql.js:236:52) at executeMigration (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:10:9) at migrate (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:71:13) at async Object.migrateIfNecessary (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\migration.js:112:9) at async initDbConnection (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\sql_init.js:41:5) ERROR: migration failed, crashing hard The database connection is not open The database connection is not open The database connection is not open TypeError: sql.getRawRows is not a function or its return value is not iterable at load (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\becca\becca_loader.js:33:27) at D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\becca\becca_loader.js:18:9 TypeError: sql.getRawRows is not a function or its return value is not iterable at load (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\becca\becca_loader.js:33:27) at D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\becca\becca_loader.js:18:9 Error: Option "spellCheckEnabled" doesn't exist at getOption (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\options.js:21:15) at Object.getOptionBool (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\options.js:46:17) at Object.createMainWindow (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\window.js:56:45) at App. (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\electron.js:33:29) Error: Option "spellCheckEnabled" doesn't exist at getOption (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\options.js:21:15) at Object.getOptionBool (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\options.js:46:17) at Object.createMainWindow (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\window.js:56:45) at App. (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\electron.js:33:29) (node:16716) UnhandledPromiseRejectionWarning: TypeError: sql.getRawRows is not a function or its return value is not iterable at load (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\becca\becca_loader.js:33:27) at D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\becca\becca_loader.js:18:9 (Use trilium --trace-warnings ... to show where the warning was created) (node:16716) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:16716) UnhandledPromiseRejectionWarning: Error: Option "spellCheckEnabled" doesn't exist at getOption (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\options.js:21:15) at Object.getOptionBool (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\options.js:46:17) at Object.createMainWindow (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\src\services\window.js:56:45) at App. (D:\鐢扮殑杞欢\trilium-windows-x64-0.57.5\trilium-windows-x64\resources\app.asar\electron.js:33:29) (node:16716) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)

zadam commented 1 year ago

Hello, there's a small database issue in your installation, I changed the migration script to be more robust. I will release a new version soon - 0.58.0-beta which will fix that.

In the meantime I recommend you to stay on the old version and restore backup-before-migration.db backup based on this guide: https://github.com/zadam/trilium/wiki/Backup#restoring-backup

sdlytcl commented 1 year ago

thank you very much!