]> git.ktnx.net Git - mobile-ledger.git/commitdiff
ordered deletion when wiping profile data
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 24 Sep 2020 15:39:14 +0000 (18:39 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 24 Sep 2020 15:39:14 +0000 (18:39 +0300)
needed so that foreigh keys can be enforced

app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java

index 62ab8f4b867b7eb765e02721f94599a0ce0b8713..6f6e51cbd6e5293dca8b9e562780e1086aa3ea3a 100644 (file)
@@ -452,12 +452,12 @@ public final class MobileLedgerProfile {
         db.beginTransactionNonExclusive();
         try {
             Object[] uuid_param = new Object[]{uuid};
-            db.execSQL("delete from profiles where uuid=?", uuid_param);
-            db.execSQL("delete from accounts where profile=?", uuid_param);
-            db.execSQL("delete from account_values where profile=?", uuid_param);
-            db.execSQL("delete from transactions where profile=?", uuid_param);
             db.execSQL("delete from transaction_accounts where profile=?", uuid_param);
+            db.execSQL("delete from transactions where profile=?", uuid_param);
+            db.execSQL("delete from account_values where profile=?", uuid_param);
+            db.execSQL("delete from accounts where profile=?", uuid_param);
             db.execSQL("delete from options where profile=?", uuid_param);
+            db.execSQL("delete from profiles where uuid=?", uuid_param);
             db.setTransactionSuccessful();
         }
         finally {