@Delete
public abstract void deleteSync(List<Account> items);
+ @Query("DELETE FROM accounts")
+ public abstract void deleteAllSync();
+
@Query("SELECT * FROM accounts WHERE profile_id=:profileId ORDER BY name")
public abstract LiveData<List<Account>> getAll(long profileId);
@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<List<AccountValue>> getAll(long accountId);
@Delete
public abstract void deleteSync(Currency item);
+ @Query("DELETE FROM currencies")
+ public abstract void deleteAllSync();
+
@Query("SELECT * FROM currencies")
public abstract LiveData<List<Currency>> getAll();
@Delete
public abstract void deleteSync(List<Option> items);
+ @Query("DELETE from options")
+ public abstract void deleteAllSync();
+
@Query("SELECT * FROM options WHERE profile_id = :profileId AND name = :name")
public abstract LiveData<Option> load(long profileId, String name);
@Delete
public abstract void deleteSync(Profile item);
+ @Query("DELETE FROM profiles")
+ public abstract void deleteAllSync();
+
@Query("select * from profiles where id = :profileId")
public abstract Profile getByIdSync(long profileId);
@Delete
void deleteSync(TemplateAccount item);
+ @Query("DELETE FROM template_accounts")
+ void deleteAllSync();
+
@Query("SELECT * FROM template_accounts WHERE template_id=:template_id")
LiveData<List<TemplateAccount>> getTemplateAccounts(Long template_id);
});
}
+ @Query("DELETE FROM templates")
+ public abstract void deleteAllSync();
+
@Query("SELECT * FROM templates ORDER BY is_fallback, UPPER(name)")
public abstract LiveData<List<TemplateHeader>> getTemplates();
@Delete
public abstract void deleteSync(List<TransactionAccount> items);
+ @Query("DELETE FROM transaction_accounts")
+ public abstract void deleteAllSync();
+
@Query("SELECT * FROM transaction_accounts WHERE id = :id")
public abstract LiveData<TransactionAccount> getById(long id);
@Delete
public abstract void deleteSync(List<Transaction> items);
+ @Query("DELETE FROM transactions")
+ public abstract void deleteAllSync();
+
@Query("SELECT * FROM transactions WHERE id = :id")
public abstract LiveData<Transaction> getById(long id);
public abstract OptionDAO getOptionDAO();
public abstract ProfileDAO getProfileDAO();
+
+ @androidx.room.Transaction
+ public void deleteAllSync() {
+ getTransactionAccountDAO().deleteAllSync();
+ getTransactionDAO().deleteAllSync();
+ getAccountValueDAO().deleteAllSync();
+ getAccountDAO().deleteAllSync();
+ getTemplateAccountDAO().deleteAllSync();
+ getTemplateDAO().deleteAllSync();
+ getCurrencyDAO().deleteAllSync();
+ getOptionDAO().deleteAllSync();
+ getProfileDAO().deleteAllSync();
+ }
}