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

Basic trade and holdings view (#1271)

* Add trade view

* Lint fix

* Fix stale placeholder variable

* Add holding view
This commit is contained in:
Zach Gollwitzer 2024-10-09 14:59:18 -04:00 committed by GitHub
parent f5cb13b42f
commit 4bfe47540d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 387 additions and 68 deletions

View file

@ -0,0 +1,33 @@
class AddNotesToEntry < ActiveRecord::Migration[7.2]
def change
add_column :account_entries, :notes, :text
add_column :account_entries, :excluded, :boolean, default: false
reversible do |dir|
dir.up do
execute <<-SQL
UPDATE account_entries
SET notes = account_transactions.notes,
excluded = account_transactions.excluded
FROM account_transactions
WHERE account_entries.entryable_type = 'Account::Transaction'
AND account_entries.entryable_id = account_transactions.id
SQL
end
dir.down do
execute <<-SQL
UPDATE account_transactions
SET notes = account_entries.notes,
excluded = account_entries.excluded
FROM account_entries
WHERE account_entries.entryable_type = 'Account::Transaction'
AND account_entries.entryable_id = account_transactions.id
SQL
end
end
remove_column :account_transactions, :notes, :text
remove_column :account_transactions, :excluded, :boolean
end
end