Cloud sync: trigger for password changes

pull/212/head
M66B 2 years ago
parent 02e06b5253
commit 4073b2d47a

@ -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_insert`");
db.execSQL("DROP TRIGGER IF EXISTS `account_update`"); 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 `account_delete`");
db.execSQL("DROP TRIGGER IF EXISTS `identity_insert`"); db.execSQL("DROP TRIGGER IF EXISTS `identity_insert`");
db.execSQL("DROP TRIGGER IF EXISTS `identity_update`"); db.execSQL("DROP TRIGGER IF EXISTS `identity_update`");
db.execSQL("DROP TRIGGER IF EXISTS `identity_password`");
db.execSQL("DROP TRIGGER IF EXISTS `identity_delete`"); 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" + db.execSQL("CREATE TRIGGER IF NOT EXISTS account_update" +
" AFTER 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" + " ON account" +
" BEGIN" + " BEGIN" +
" INSERT INTO sync ('entity', 'reference', 'action', 'time')" + " INSERT INTO sync ('entity', 'reference', 'action', 'time')" +
" VALUES ('account', NEW.uuid, 'update', strftime('%s') * 1000);" + " VALUES ('account', NEW.uuid, 'update', strftime('%s') * 1000);" +
" END"); " 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" + db.execSQL("CREATE TRIGGER IF NOT EXISTS account_delete" +
" AFTER DELETE ON account" + " AFTER DELETE ON account" +
" BEGIN" + " BEGIN" +
@ -584,13 +593,20 @@ public abstract class DB extends RoomDatabase {
db.execSQL("CREATE TRIGGER IF NOT EXISTS identity_update" + db.execSQL("CREATE TRIGGER IF NOT EXISTS identity_update" +
" AFTER 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" + " ON identity" +
" BEGIN" + " BEGIN" +
" INSERT INTO sync ('entity', 'reference', 'action', 'time')" + " INSERT INTO sync ('entity', 'reference', 'action', 'time')" +
" VALUES ('identity', NEW.uuid, 'update', strftime('%s') * 1000);" + " VALUES ('identity', NEW.uuid, 'update', strftime('%s') * 1000);" +
" END"); " 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" + db.execSQL("CREATE TRIGGER IF NOT EXISTS identity_delete" +
" AFTER DELETE ON identity" + " AFTER DELETE ON identity" +
" BEGIN" + " BEGIN" +

Loading…
Cancel
Save