From 833544eb24cb630dc1ce221e4aa3dedb3f6341e3 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 12 Sep 2021 14:30:09 +0300 Subject: [PATCH] methods for deleting all DB tables --- .../java/net/ktnx/mobileledger/dao/AccountDAO.java | 3 +++ .../net/ktnx/mobileledger/dao/AccountValueDAO.java | 3 +++ .../java/net/ktnx/mobileledger/dao/CurrencyDAO.java | 3 +++ .../java/net/ktnx/mobileledger/dao/OptionDAO.java | 3 +++ .../java/net/ktnx/mobileledger/dao/ProfileDAO.java | 3 +++ .../ktnx/mobileledger/dao/TemplateAccountDAO.java | 3 +++ .../ktnx/mobileledger/dao/TemplateHeaderDAO.java | 3 +++ .../mobileledger/dao/TransactionAccountDAO.java | 3 +++ .../net/ktnx/mobileledger/dao/TransactionDAO.java | 3 +++ app/src/main/java/net/ktnx/mobileledger/db/DB.java | 13 +++++++++++++ 10 files changed, 40 insertions(+) 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