From 8565e53bfc3b599a0585dd7701307cf8e9e29279 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 31 Jan 2023 07:36:36 +0100 Subject: [PATCH] Refactoring --- app/src/main/java/eu/faircode/email/DB.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/DB.java b/app/src/main/java/eu/faircode/email/DB.java index 7217381e2f..eecba88728 100644 --- a/app/src/main/java/eu/faircode/email/DB.java +++ b/app/src/main/java/eu/faircode/email/DB.java @@ -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 image = new ArrayList<>(); for (String img : ImageHelper.IMAGE_TYPES)