1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-02 03:55:20 +02:00

Additional cache columns on balances for activity view breakdowns (#2505)

* Initial schema iteration

* Add new balance components

* Add existing data migrator to backfill components

* Update calculator test assertions for new balance components

* Update flow assertions for forward calculator

* Update reverse calculator flows assumptions

* Forward calculator tests passing

* Get all calculator tests passing

* Assert flows factor
This commit is contained in:
Zach Gollwitzer 2025-07-23 10:06:25 -04:00 committed by GitHub
parent 347c0a7906
commit da2045dbd8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 1159 additions and 177 deletions

View file

@ -154,4 +154,19 @@ namespace :data_migration do
puts " Processed: #{accounts_processed} accounts"
puts " Opening anchors set: #{opening_anchors_set}"
end
desc "Migrate balance components"
# 2025-07-20: Migrate balance components to support event-sourced ledger model.
# This task:
# 1. Sets the flows_factor for each account based on the account's classification
# 2. Sets the start_cash_balance, start_non_cash_balance, and start_balance for each balance
# 3. Sets the cash_inflows, cash_outflows, non_cash_inflows, non_cash_outflows, net_market_flows, cash_adjustments, and non_cash_adjustments for each balance
# 4. Sets the end_cash_balance, end_non_cash_balance, and end_balance for each balance
task migrate_balance_components: :environment do
puts "==> Migrating balance components..."
BalanceComponentMigrator.run
puts "✅ Balance component migration complete."
end
end