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:
parent
f5cb13b42f
commit
4bfe47540d
25 changed files with 387 additions and 68 deletions
33
db/migrate/20241009132959_add_notes_to_entry.rb
Normal file
33
db/migrate/20241009132959_add_notes_to_entry.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue