mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 15:49:39 +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
|
8
db/schema.rb
generated
8
db/schema.rb
generated
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_10_08_122449) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_10_09_132959) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
enable_extension "plpgsql"
|
||||
|
@ -45,6 +45,8 @@ ActiveRecord::Schema[7.2].define(version: 2024_10_08_122449) do
|
|||
t.uuid "transfer_id"
|
||||
t.boolean "marked_as_transfer", default: false, null: false
|
||||
t.uuid "import_id"
|
||||
t.text "notes"
|
||||
t.boolean "excluded", default: false
|
||||
t.index ["account_id"], name: "index_account_entries_on_account_id"
|
||||
t.index ["import_id"], name: "index_account_entries_on_import_id"
|
||||
t.index ["transfer_id"], name: "index_account_entries_on_transfer_id"
|
||||
|
@ -90,8 +92,6 @@ ActiveRecord::Schema[7.2].define(version: 2024_10_08_122449) do
|
|||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.uuid "category_id"
|
||||
t.boolean "excluded", default: false
|
||||
t.text "notes"
|
||||
t.uuid "merchant_id"
|
||||
t.index ["category_id"], name: "index_account_transactions_on_category_id"
|
||||
t.index ["merchant_id"], name: "index_account_transactions_on_merchant_id"
|
||||
|
@ -120,7 +120,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_10_08_122449) do
|
|||
t.boolean "is_active", default: true, null: false
|
||||
t.date "last_sync_date"
|
||||
t.uuid "institution_id"
|
||||
t.virtual "classification", type: :string, as: "\nCASE\n WHEN ((accountable_type)::text = ANY (ARRAY[('Loan'::character varying)::text, ('CreditCard'::character varying)::text, ('OtherLiability'::character varying)::text])) THEN 'liability'::text\n ELSE 'asset'::text\nEND", stored: true
|
||||
t.virtual "classification", type: :string, as: "\nCASE\n WHEN ((accountable_type)::text = ANY ((ARRAY['Loan'::character varying, 'CreditCard'::character varying, 'OtherLiability'::character varying])::text[])) THEN 'liability'::text\n ELSE 'asset'::text\nEND", stored: true
|
||||
t.uuid "import_id"
|
||||
t.index ["accountable_type"], name: "index_accounts_on_accountable_type"
|
||||
t.index ["family_id"], name: "index_accounts_on_family_id"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue