diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-10-14 20:40:23 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-10-14 20:40:23 +0300 |
commit | f9cf63d9497804dca721ad7892167ffe201f4735 (patch) | |
tree | 11245a2f47a162588cb0936ba5fb6bc9312ff6c7 /app/src | |
parent | 84b84729fa5efeeaa53a682b4abeabb77e2a2b35 (diff) |
Fix migration
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/it/niedermann/owncloud/notes/persistence/entity/NoteWithCategory.java | 2 | ||||
-rw-r--r-- | app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_19_20.java | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/persistence/entity/NoteWithCategory.java b/app/src/main/java/it/niedermann/owncloud/notes/persistence/entity/NoteWithCategory.java index e47595f9..2ddcb836 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/persistence/entity/NoteWithCategory.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/persistence/entity/NoteWithCategory.java @@ -96,7 +96,7 @@ public class NoteWithCategory implements Serializable, Item { @Override public String toString() { return "NoteWithCategory{" + - "note=" + note.getTitle() + + "note=" + note + ", category='" + category + '\'' + '}'; } diff --git a/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_19_20.java b/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_19_20.java index ca42803d..bff6f181 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_19_20.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_19_20.java @@ -63,6 +63,8 @@ public class Migration_19_20 extends Migration { db.execSQL("CREATE INDEX `IDX_SINGLENOTEWIDGETDATA_ACCOUNTID` ON `SingleNoteWidgetData` (`accountId`)"); db.execSQL("CREATE INDEX `IDX_SINGLENOTEWIDGETDATA_NOTEID` ON `SingleNoteWidgetData` (`noteId`)"); + db.execSQL("CREATE UNIQUE INDEX `IDX_UNIQUE_ACCOUNT_TITLE` ON `Category` (`accountId`, `title`)"); + db.execSQL("CREATE TRIGGER TRG_CLEANUP_CATEGORIES_DEL AFTER DELETE ON Note BEGIN DELETE FROM Category WHERE Category.id NOT IN (SELECT Note.categoryId FROM Note); END;"); db.execSQL("CREATE TRIGGER TRG_CLEANUP_CATEGORIES_UPD AFTER UPDATE ON Note BEGIN DELETE FROM Category WHERE Category.id NOT IN (SELECT Note.categoryId FROM Note); END;"); |