Cloud sync: trigger for password changes

This commit is contained in:
M66B 2023-01-16 17:49:22 +01:00
parent 02e06b5253
commit 4073b2d47a
1 changed files with 18 additions and 2 deletions

View File

@ -485,10 +485,12 @@ public abstract class DB extends RoomDatabase {
db.execSQL("DROP TRIGGER IF EXISTS `account_insert`");
db.execSQL("DROP TRIGGER IF EXISTS `account_update`");
db.execSQL("DROP TRIGGER IF EXISTS `account_password`");
db.execSQL("DROP TRIGGER IF EXISTS `account_delete`");
db.execSQL("DROP TRIGGER IF EXISTS `identity_insert`");
db.execSQL("DROP TRIGGER IF EXISTS `identity_update`");
db.execSQL("DROP TRIGGER IF EXISTS `identity_password`");
db.execSQL("DROP TRIGGER IF EXISTS `identity_delete`");
}
@ -561,13 +563,20 @@ public abstract class DB extends RoomDatabase {
db.execSQL("CREATE TRIGGER IF NOT EXISTS account_update" +
" AFTER UPDATE" +
" OF host, encryption, insecure, port, auth_type, provider, `user`, password, certificate_alias, realm, fingerprint" +
" OF host, encryption, insecure, port, auth_type, provider, `user`, certificate_alias, realm, fingerprint" +
" ON account" +
" BEGIN" +
" INSERT INTO sync ('entity', 'reference', 'action', 'time')" +
" VALUES ('account', NEW.uuid, 'update', strftime('%s') * 1000);" +
" END");
db.execSQL("CREATE TRIGGER IF NOT EXISTS account_password" +
" AFTER UPDATE OF password ON account" +
" BEGIN" +
" INSERT INTO sync ('entity', 'reference', 'action', 'time')" +
" VALUES ('account', NEW.uuid, 'password', strftime('%s') * 1000);" +
" END");
db.execSQL("CREATE TRIGGER IF NOT EXISTS account_delete" +
" AFTER DELETE ON account" +
" BEGIN" +
@ -584,13 +593,20 @@ public abstract class DB extends RoomDatabase {
db.execSQL("CREATE TRIGGER IF NOT EXISTS identity_update" +
" AFTER UPDATE" +
" OF host, encryption, insecure, port, auth_type, provider, `user`, password, certificate_alias, realm, fingerprint" +
" OF host, encryption, insecure, port, auth_type, provider, `user`, certificate_alias, realm, fingerprint" +
" ON identity" +
" BEGIN" +
" INSERT INTO sync ('entity', 'reference', 'action', 'time')" +
" VALUES ('identity', NEW.uuid, 'update', strftime('%s') * 1000);" +
" END");
db.execSQL("CREATE TRIGGER IF NOT EXISTS identity_password" +
" AFTER UPDATE OF password ON identity" +
" BEGIN" +
" INSERT INTO sync ('entity', 'reference', 'action', 'time')" +
" VALUES ('identity', NEW.uuid, 'password', strftime('%s') * 1000);" +
" END");
db.execSQL("CREATE TRIGGER IF NOT EXISTS identity_delete" +
" AFTER DELETE ON identity" +
" BEGIN" +