fix old migration to avoid unique constraints problems, closes #3447

This commit is contained in:
zadam 2022-12-22 15:11:20 +01:00
parent 5a3882f388
commit e05e4bec32
2 changed files with 12 additions and 15 deletions

View File

@ -1,4 +1,7 @@
CREATE TABLE IF NOT EXISTS "mig_entity_changes" (
DROP TABLE entity_changes;
-- not preserving the data because of https://github.com/zadam/trilium/issues/3447
CREATE TABLE IF NOT EXISTS "entity_changes" (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`entityName` TEXT NOT NULL,
`entityId` TEXT NOT NULL,
@ -11,13 +14,6 @@ CREATE TABLE IF NOT EXISTS "mig_entity_changes" (
`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`

15
package-lock.json generated
View File

@ -5,6 +5,7 @@
"requires": true,
"packages": {
"": {
"name": "trilium",
"version": "0.57.5",
"hasInstallScript": true,
"license": "AGPL-3.0-only",
@ -57,7 +58,7 @@
"rimraf": "3.0.2",
"safe-compare": "1.1.4",
"sanitize-filename": "1.6.3",
"sanitize-html": "2.8.0",
"sanitize-html": "2.8.1",
"sax": "1.2.4",
"semver": "7.3.8",
"serve-favicon": "2.5.0",
@ -8670,9 +8671,9 @@
}
},
"node_modules/sanitize-html": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-2.8.0.tgz",
"integrity": "sha512-ZsGyc6avnqgvEm3eMKrcy8xa7WM1MrGrfkGsUgQee2CU+vg3PCfNCexXwBDF/6dEPvaQ4k/QqRjnYKHL8xgNjg==",
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-2.8.1.tgz",
"integrity": "sha512-qK5neD0SaMxGwVv5txOYv05huC3o6ZAA4h5+7nJJgWMNFUNRjcjLO6FpwAtKzfKCZ0jrG6xTk6eVFskbvOGblg==",
"dependencies": {
"deepmerge": "^4.2.2",
"escape-string-regexp": "^4.0.0",
@ -17231,9 +17232,9 @@
}
},
"sanitize-html": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-2.8.0.tgz",
"integrity": "sha512-ZsGyc6avnqgvEm3eMKrcy8xa7WM1MrGrfkGsUgQee2CU+vg3PCfNCexXwBDF/6dEPvaQ4k/QqRjnYKHL8xgNjg==",
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-2.8.1.tgz",
"integrity": "sha512-qK5neD0SaMxGwVv5txOYv05huC3o6ZAA4h5+7nJJgWMNFUNRjcjLO6FpwAtKzfKCZ0jrG6xTk6eVFskbvOGblg==",
"requires": {
"deepmerge": "^4.2.2",
"escape-string-regexp": "^4.0.0",