mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
feat(db-compare): adapt to v214
This commit is contained in:
parent
b56ae01990
commit
886dd60dd0
17
apps/db-compare/README.md
Normal file
17
apps/db-compare/README.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Database compare tool
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The original implementation was signficantly out of date. While we have made the effort of updating dependencies and getting it to run, currently it only compares the old database structure (v214).
|
||||||
|
|
||||||
|
To build and run manually:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
nx build db-compare
|
||||||
|
node ./apps/db-compare/dist/compare.js
|
||||||
|
```
|
||||||
|
|
||||||
|
To serve development build with arguments:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
nx serve db-compare --args "apps/server/spec/db/document_v214.db" --args "apps/server/spec/db/document_v214_migrated.db"
|
||||||
|
```
|
@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
import jsDiff from "diff";
|
import * as jsDiff from "diff";
|
||||||
import * as sqlite from "sqlite";
|
import * as sqlite from "sqlite";
|
||||||
import * as sqlite3 from "sqlite3";
|
import * as sqlite3 from "sqlite3";
|
||||||
import sql from "./sql.js";
|
import sql from "./sql.js";
|
||||||
@ -101,7 +101,7 @@ async function main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await compare("branches", "branchId",
|
await compare("branches", "branchId",
|
||||||
"SELECT branchId, noteId, parentNoteId, notePosition, utcDateCreated, isDeleted, prefix FROM branches");
|
"SELECT branchId, noteId, parentNoteId, notePosition, utcDateModified, isDeleted, prefix FROM branches");
|
||||||
|
|
||||||
await compare("notes", "noteId",
|
await compare("notes", "noteId",
|
||||||
"SELECT noteId, title, dateCreated, utcDateCreated, isProtected, isDeleted FROM notes WHERE isDeleted = 0");
|
"SELECT noteId, title, dateCreated, utcDateCreated, isProtected, isDeleted FROM notes WHERE isDeleted = 0");
|
||||||
@ -116,13 +116,13 @@ async function main() {
|
|||||||
"SELECT noteRevisionId, content FROM note_revision_contents");
|
"SELECT noteRevisionId, content FROM note_revision_contents");
|
||||||
|
|
||||||
await compare("options", "name",
|
await compare("options", "name",
|
||||||
`SELECT name, value, utcDateCreated FROM options WHERE isSynced = 1`);
|
`SELECT name, value, utcDateModified FROM options WHERE isSynced = 1`);
|
||||||
|
|
||||||
await compare("attributes", "attributeId",
|
await compare("attributes", "attributeId",
|
||||||
"SELECT attributeId, noteId, type, name, value FROM attributes");
|
"SELECT attributeId, noteId, type, name, value FROM attributes");
|
||||||
|
|
||||||
await compare("api_tokens", "apiTokenId",
|
await compare("etapi_tokens", "etapiTokenId",
|
||||||
"SELECT apiTokenId, token, utcDateCreated, isDeleted FROM api_tokens");
|
"SELECT etapiTokenId, name, tokenHash, utcDateCreated, utcDateModified, isDeleted FROM etapi_tokens");
|
||||||
|
|
||||||
await compare("entity_changes", "uniqueId",
|
await compare("entity_changes", "uniqueId",
|
||||||
"SELECT entityName || '-' || entityId AS uniqueId, hash, isErased, utcDateChanged FROM entity_changes WHERE isSynced = 1");
|
"SELECT entityName || '-' || entityId AS uniqueId, hash, isErased, utcDateChanged FROM entity_changes WHERE isSynced = 1");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user