1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 05:09:38 +02:00
Maybe/db/migrate/20240209200924_create_exchange_rates.rb
Josh Pigford aa351ae616
Multi-currency support (#425)
* Initial foundational pass at multi-currency

* Default format currency

* More work on currency and exchanging

* Re-build currencies on change

* Currency import/setup

* Background job overhaul + cheaper OXR plan support

* Lint fixes

* Test fixes

* Multi-currency setup instructions

* Allow decimals in the balance field

* Spacing fix for form

---------

Signed-off-by: Josh Pigford <josh@joshpigford.com>
2024-02-10 16:18:56 -06:00

16 lines
476 B
Ruby

class CreateExchangeRates < ActiveRecord::Migration[7.2]
def change
create_table :exchange_rates, id: :uuid do |t|
t.string :base_currency, null: false
t.string :converted_currency, null: false
t.decimal :rate
t.date :date
t.timestamps
end
add_index :exchange_rates, :base_currency
add_index :exchange_rates, :converted_currency
add_index :exchange_rates, %i[base_currency converted_currency date], unique: true
end
end