mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-25 08:09:38 +02:00
* Integrate money-rails gem * Fix Lint issues * Basic test for monetize feature * Merge main branch * Changes to monetize balance field --------- Co-authored-by: Zach Gollwitzer <zach.gollwitzer@gmail.com>
14 lines
404 B
Ruby
14 lines
404 B
Ruby
class ReplaceMoneyField < ActiveRecord::Migration[7.2]
|
|
def change
|
|
add_monetize :accounts, :balance
|
|
change_column :accounts, :balance_cents, :integer, limit: 8
|
|
|
|
Account.reset_column_information
|
|
|
|
Account.find_each do |account|
|
|
account.update_columns(balance_cents: Money.from_amount(account.balance, account.currency).cents)
|
|
end
|
|
|
|
remove_column :accounts, :balance
|
|
end
|
|
end
|