Skip to content

Build your personal knowledge base with Trilium Notes

removal of isErased from old entities

zadam4a15127e5813
diff --git a/db/migrations/0174__isErased_in_entity_changes.sql b/db/migrations/0173__isErased_in_entity_changes.sql
similarity index 100%
rename from db/migrations/0174__isErased_in_entity_changes.sql
rename to db/migrations/0173__isErased_in_entity_changes.sql
diff --git a/db/migrations/0173__move_hash_to_entity_changes.sql b/db/migrations/0174__move_hash_to_entity_changes.sql
similarity index 93%
rename from db/migrations/0173__move_hash_to_entity_changes.sql
rename to db/migrations/0174__move_hash_to_entity_changes.sql
index 32d351cb25..2f7500c488 100644
--- a/db/migrations/0173__move_hash_to_entity_changes.sql
+++ b/db/migrations/0174__move_hash_to_entity_changes.sql
@@ -3,11 +3,12 @@ CREATE TABLE IF NOT EXISTS "mig_entity_changes" (
`entityName` TEXT NOT NULL,
`entityId` TEXT NOT NULL,
`hash` TEXT NOT NULL,
+ `isErased` INT NOT NULL,
`sourceId` TEXT NOT NULL,
`isSynced` INTEGER NOT NULL);
-INSERT INTO mig_entity_changes (entityName, entityId, hash, sourceId, isSynced)
- SELECT entityName, entityId, '', sourceId, isSynced FROM entity_changes;
+INSERT INTO mig_entity_changes (entityName, entityId, hash, sourceId, isSynced, isErased)
+ SELECT entityName, entityId, '', sourceId, isSynced, isErased FROM entity_changes;
UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM api_tokens WHERE apiTokenId = entityId), '') WHERE entityName = 'api_tokens';
UPDATE mig_entity_changes SET hash = COALESCE((SELECT hash FROM attributes WHERE attributeId = entityId), '') WHERE entityName = 'attributes';
@@ -97,15 +98,14 @@ CREATE TABLE IF NOT EXISTS "mig_notes" (
`mime` TEXT NOT NULL DEFAULT 'text/html',
`isDeleted` INT NOT NULL DEFAULT 0,
`deleteId` TEXT DEFAULT NULL,
- `isErased` INT NOT NULL DEFAULT 0,
`dateCreated` TEXT NOT NULL,
`dateModified` TEXT NOT NULL,
`utcDateCreated` TEXT NOT NULL,
`utcDateModified` TEXT NOT NULL,
PRIMARY KEY(`noteId`));
-INSERT INTO mig_notes (noteId, title, isProtected, type, mime, isDeleted, deleteId, isErased, dateCreated, dateModified, utcDateCreated, utcDateModified)
-SELECT noteId, title, isProtected, type, mime, isDeleted, deleteId, isErased, dateCreated, dateModified, utcDateCreated, utcDateModified FROM notes;
+INSERT INTO mig_notes (noteId, title, isProtected, type, mime, isDeleted, deleteId, dateCreated, dateModified, utcDateCreated, utcDateModified)
+SELECT noteId, title, isProtected, type, mime, isDeleted, deleteId, dateCreated, dateModified, utcDateCreated, utcDateModified FROM notes;
DROP TABLE notes;
ALTER TABLE mig_notes RENAME TO notes;
@@ -137,7 +137,6 @@ CREATE TABLE IF NOT EXISTS "mig_note_revisions" (`noteRevisionId` TEXT NOT NULL
type TEXT DEFAULT '' NOT NULL,
mime TEXT DEFAULT '' NOT NULL,
`title` TEXT,
- `isErased` INT NOT NULL DEFAULT 0,
`isProtected` INT NOT NULL DEFAULT 0,
`utcDateLastEdited` TEXT NOT NULL,
`utcDateCreated` TEXT NOT NULL,
@@ -145,8 +144,8 @@ CREATE TABLE IF NOT EXISTS "mig_note_revisions" (`noteRevisionId` TEXT NOT NULL
`dateLastEdited` TEXT NOT NULL,
`dateCreated` TEXT NOT NULL);
-INSERT INTO mig_note_revisions (noteRevisionId, noteId, type, mime, title, isErased, isProtected, utcDateLastEdited, utcDateCreated, utcDateModified, dateLastEdited, dateCreated)
-SELECT noteRevisionId, noteId, type, mime, title, isErased, isProtected, utcDateLastEdited, utcDateCreated, utcDateModified, dateLastEdited, dateCreated FROM note_revisions;
+INSERT INTO mig_note_revisions (noteRevisionId, noteId, type, mime, title, isProtected, utcDateLastEdited, utcDateCreated, utcDateModified, dateLastEdited, dateCreated)
+SELECT noteRevisionId, noteId, type, mime, title, isProtected, utcDateLastEdited, utcDateCreated, utcDateModified, dateLastEdited, dateCreated FROM note_revisions;
DROP TABLE note_revisions;
ALTER TABLE mig_note_revisions RENAME TO note_revisions;
diff --git a/db/schema.sql b/db/schema.sql
index 656dc488e3..38a1b9d91d 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -29,7 +29,6 @@ CREATE TABLE IF NOT EXISTS "notes" (
`mime` TEXT NOT NULL DEFAULT 'text/html',
`isDeleted` INT NOT NULL DEFAULT 0,
`deleteId` TEXT DEFAULT NULL,
- `isErased` INT NOT NULL DEFAULT 0,
`dateCreated` TEXT NOT NULL,
`dateModified` TEXT NOT NULL,
`utcDateCreated` TEXT NOT NULL,
@@ -53,7 +52,6 @@ CREATE TABLE IF NOT EXISTS "note_revisions" (`noteRevisionId` TEXT NOT NULL PRIM
type TEXT DEFAULT '' NOT NULL,
mime TEXT DEFAULT '' NOT NULL,
`title` TEXT,
- `isErased` INT NOT NULL DEFAULT 0,
`isProtected` INT NOT NULL DEFAULT 0,
`utcDateLastEdited` TEXT NOT NULL,
`utcDateCreated` TEXT NOT NULL,