Reduce number of invalidations

This commit is contained in:
M66B
2019-06-07 17:01:06 +02:00
parent 01bfae0ddd
commit 845eff88b4
13 changed files with 1994 additions and 62 deletions

View File

@@ -54,7 +54,7 @@ import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 86,
version = 87,
entities = {
EntityIdentity.class,
EntityAccount.class,
@@ -68,7 +68,10 @@ import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory;
EntityLog.class
},
views = {
EntityFolderView.class
EntityAccountProp.class,
EntityFolderProp.class,
EntityAttachmentProp.class,
EntityOperationProp.class
}
)
@@ -863,6 +866,21 @@ public abstract class DB extends RoomDatabase {
db.execSQL("CREATE VIEW `folderview` AS SELECT id, account, name, type, display, unified FROM folder");
}
})
.addMigrations(new Migration(86, 87) {
@Override
public void migrate(SupportSQLiteDatabase db) {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("DROP VIEW `folderview`");
db.execSQL("CREATE VIEW `accountprop` AS " +
"SELECT id, name, color, synchronize, `primary`, notify, browse, swipe_left, swipe_right, created, `order` FROM account");
db.execSQL("CREATE VIEW `folderprop` AS " +
"SELECT id, account, name, type, download, display, unified, notify FROM folder");
db.execSQL("CREATE VIEW `attachmentprop` AS " +
"SELECT id, message, name FROM attachment");
db.execSQL("CREATE VIEW `operationprop` AS " +
"SELECT id, folder, message, name FROM operation");
}
})
.build();
}