Refactoring

This commit is contained in:
M66B 2023-01-31 07:36:36 +01:00
parent 0a5cfdfbc9
commit 8565e53bfc
1 changed files with 10 additions and 7 deletions

View File

@ -489,13 +489,8 @@ public abstract class DB extends RoomDatabase {
Log.i("Get PRAGMA " + pragma + "=<?>");
}
if (BuildConfig.DEBUG) {
db.execSQL("DROP TRIGGER IF EXISTS `attachment_insert`");
db.execSQL("DROP TRIGGER IF EXISTS `attachment_delete`");
db.execSQL("DROP TRIGGER IF EXISTS `account_update`");
db.execSQL("DROP TRIGGER IF EXISTS `identity_update`");
}
if (BuildConfig.DEBUG && false)
dropTriggers(db);
createTriggers(db);
}
@ -528,6 +523,14 @@ public abstract class DB extends RoomDatabase {
}
}
private static void dropTriggers(@NonNull SupportSQLiteDatabase db) {
db.execSQL("DROP TRIGGER IF EXISTS `attachment_insert`");
db.execSQL("DROP TRIGGER IF EXISTS `attachment_delete`");
db.execSQL("DROP TRIGGER IF EXISTS `account_update`");
db.execSQL("DROP TRIGGER IF EXISTS `identity_update`");
}
private static void createTriggers(@NonNull SupportSQLiteDatabase db) {
List<String> image = new ArrayList<>();
for (String img : ImageHelper.IMAGE_TYPES)