From: Damyan Ivanov Date: Sun, 12 Sep 2021 11:30:09 +0000 (+0300) Subject: methods for deleting all DB tables X-Git-Tag: v0.20.2~5 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=833544eb24cb630dc1ce221e4aa3dedb3f6341e3;p=mobile-ledger.git methods for deleting all DB tables --- diff --git a/app/src/main/java/net/ktnx/mobileledger/dao/AccountDAO.java b/app/src/main/java/net/ktnx/mobileledger/dao/AccountDAO.java index 677fa81e..0c581787 100644 --- a/app/src/main/java/net/ktnx/mobileledger/dao/AccountDAO.java +++ b/app/src/main/java/net/ktnx/mobileledger/dao/AccountDAO.java @@ -75,6 +75,9 @@ public abstract class AccountDAO extends BaseDAO { @Delete public abstract void deleteSync(List items); + @Query("DELETE FROM accounts") + public abstract void deleteAllSync(); + @Query("SELECT * FROM accounts WHERE profile_id=:profileId ORDER BY name") public abstract LiveData> getAll(long profileId); diff --git a/app/src/main/java/net/ktnx/mobileledger/dao/AccountValueDAO.java b/app/src/main/java/net/ktnx/mobileledger/dao/AccountValueDAO.java index 54a42c12..8a7e5fb7 100644 --- a/app/src/main/java/net/ktnx/mobileledger/dao/AccountValueDAO.java +++ b/app/src/main/java/net/ktnx/mobileledger/dao/AccountValueDAO.java @@ -41,6 +41,9 @@ public abstract class AccountValueDAO extends BaseDAO { @Delete public abstract void deleteSync(AccountValue item); + @Query("DELETE FROM account_values") + public abstract void deleteAllSync(); + @Query("SELECT * FROM account_values WHERE account_id=:accountId") public abstract LiveData> getAll(long accountId); diff --git a/app/src/main/java/net/ktnx/mobileledger/dao/CurrencyDAO.java b/app/src/main/java/net/ktnx/mobileledger/dao/CurrencyDAO.java index 46e86358..1505a8fe 100644 --- a/app/src/main/java/net/ktnx/mobileledger/dao/CurrencyDAO.java +++ b/app/src/main/java/net/ktnx/mobileledger/dao/CurrencyDAO.java @@ -40,6 +40,9 @@ public abstract class CurrencyDAO extends BaseDAO { @Delete public abstract void deleteSync(Currency item); + @Query("DELETE FROM currencies") + public abstract void deleteAllSync(); + @Query("SELECT * FROM currencies") public abstract LiveData> getAll(); diff --git a/app/src/main/java/net/ktnx/mobileledger/dao/OptionDAO.java b/app/src/main/java/net/ktnx/mobileledger/dao/OptionDAO.java index 5540b233..41d6464b 100644 --- a/app/src/main/java/net/ktnx/mobileledger/dao/OptionDAO.java +++ b/app/src/main/java/net/ktnx/mobileledger/dao/OptionDAO.java @@ -43,6 +43,9 @@ public abstract class OptionDAO extends BaseDAO