Class: CreateCurrencyRates

Inherits:
Sequel::Migration
  • Object
show all
Defined in:
lib/exchange_rate/db/migrate/20180827184400_create_currency_rates.rb

Instance Method Summary collapse

Instance Method Details

#downObject



15
16
17
# File 'lib/exchange_rate/db/migrate/20180827184400_create_currency_rates.rb', line 15

def down
  self << 'DROP TABLE currency_rates'
end

#upObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/exchange_rate/db/migrate/20180827184400_create_currency_rates.rb', line 4

def up
  create_table(:currency_rates) do |_t|
    primary_key :id
    String :currency, null: false
    BigDecimal :value_in_euro, null: false
    Date  :date_of_rate, null: false

    index %i[currency date_of_rate], unique: true
  end
end