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
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