Cloud sync: last modification improvements

This commit is contained in:
M66B
2023-01-20 08:31:12 +01:00
parent 31f6fedb31
commit a4ac9e00e9
5 changed files with 10 additions and 8 deletions

View File

@@ -489,7 +489,7 @@ public abstract class DB extends RoomDatabase {
Log.i("Get PRAGMA " + pragma + "=<?>");
}
if (BuildConfig.DEBUG && false) {
if (BuildConfig.DEBUG) {
db.execSQL("DROP TRIGGER IF EXISTS `attachment_insert`");
db.execSQL("DROP TRIGGER IF EXISTS `attachment_delete`");
@@ -561,14 +561,16 @@ public abstract class DB extends RoomDatabase {
" AFTER UPDATE ON account" +
" BEGIN" +
" UPDATE account SET last_modified = strftime('%s') * 1000" +
" WHERE (NEW.auth_type = " + AUTH_TYPE_PASSWORD + " OR OLD.password = NEW.password);" +
" WHERE id = NEW.id" +
" AND (NEW.auth_type = " + AUTH_TYPE_PASSWORD + " OR OLD.password = NEW.password);" +
" END");
db.execSQL("CREATE TRIGGER IF NOT EXISTS identity_update" +
" AFTER UPDATE ON identity" +
" BEGIN" +
" UPDATE identity SET last_modified = strftime('%s') * 1000" +
" WHERE (NEW.auth_type = " + AUTH_TYPE_PASSWORD + " OR OLD.password = NEW.password);" +
" WHERE id = NEW.id" +
" AND (NEW.auth_type = " + AUTH_TYPE_PASSWORD + " OR OLD.password = NEW.password);" +
" END");
}