# Actualbudget Queries This is a Rust library defining queries for querying an Actualbudget database export. ## Creating the test database To re-create the test database from scratch: 1. Open an instance of Actualbudget 2. Start a new file 3. Add a new local account, called 'My bank account', with an initial balance of 1200.00 4. Add a new local account, called 'My cash account', with an initial balance of 45.10 5. Add a new local account, called 'Category transfers', with an initial balance of nil 6. Move the Starting Balance transaction for both to 1 Aug 2024 7. Go to the Budgets tab 8. Adjust the budgets for the existing categories for August 2024: - Usual Expenses, under which: - Food: 200 - General: 100 - Bills: 125 - Bills (flexible): 25 - Investments and Savings, under which: - Savings: 400 9. Add transactions for Income for 846.46 in the 'My bank account' on 21 Aug, Sept, Oct and Nov 2024, with the 'Note' column set to 'Salary', ticking the 'cleared' box 10. On 10 Sept 2024, add a transaction in 'My bank account' transferring 80.00 to 'My cash account' with no Note, and tick the 'cleared' box 11. Add transactions for 200.00 to 'Tesco' in 'My bank account', categorised as 'Food', for 8 Aug, Sept, Oct, and Nov 2024 12. In the 'Category transfers' account, add a transaction for 23rd Oct 2024, transferring 120.00 from 'Savings' to 'General' 13. Export the database by going to Settings > Export data 14. Download the resulting ZIP archive 15. Extract `db.sqlite` and `metadata.json` 16. Move them to `actualbudget_queries/tests/resources/actualbudget_test_db.sqlite` and `actualbudget_queries/tests/resources/actualbudget_test_db_metadata.json` respectively, overwriting the files which are already there 17. Format the JSON in `actualbudget_test_db_metadata.json` to minimise diffs ## Updating the test database To make a change to the test database: 1. Make a copy of `actualbudget_test_db_metadata.json` and rename it to `metadata.json` 2. Make a copy of `actualbudget_test_db.sqlite` and rename it to `db.sqlite` 3. Compress these files together in a `.zip` archive 4. Open an instance of Actualbudget 5. If you have a file open, close it 6. Choose 'Import file' 7. Choose to import an 'Actual' file 8. Choose the ZIP archive you just made 9. This should open the file 10. Make your edits 11. Document your edits in [the database creation guide](#creating-the-test-database) 12. Export the database by going to Settings > Export data 13. Download the resulting ZIP archive 14. Extract the `.sqlite` database file 15. Move them to `actualbudget_queries/tests/resources/actualbudget_test_db.sqlite` and `actualbudget_queries/tests/resources/actualbudget_test_db_metadata.json` respectively, overwriting the files which are already there 16. Format the JSON in `actualbudget_test_db_metadata.json` to minimise diffs