class CreateCurrencyTypes

Public Class Methods

down() click to toggle source
# File lib/generators/tcmb_currency/migration/templates/typemigration.rb, line 15
def self.down
  drop_table :currency_types
end
up() click to toggle source
# File lib/generators/tcmb_currency/migration/templates/typemigration.rb, line 2
def self.up
  create_table :currency_types do |t|
    t.string :currency

    t.timestamps
  end
  currencies = %w[ USD EUR GBP TRY CAD XDR DKK SEK CHF NOK
                   JPY SAR KWD AUD RUB RON PKR IRR CNY BGN ]
  currencies.each do |c|
    CURRENCY_TYPE.create(currency: c.to_s)
  end
end