class BuildDb < ActiveRecord::Migration
  def self.up
    create_table :countries do |t|
      t.column :code, :string
      t.column :name, :string
      t.column :price_per_usd, :float
    end

    Country.create :code => 'USA', 
                   :name => 'United States of America',
                   :price_per_usd => 1
    Country.create :code => 'CAN', 
                   :name => 'Canada',
                   :price_per_usd =>  1.1617
    Country.create :code => 'GBR', 
                   :name => 'United Kingdom',
                   :price_per_usd =>  0.566301

    create_table :books do |t|
      t.column :name, :string
      t.column :isbn, :string
    end

    Book.create :name => 'Perl Cookbook', :isbn => '957824732X'
    Book.create :name => 'Java Cookbook', :isbn => '9867794141'
  end

  def self.down
    drop_table :countries
    drop_table :books
  end
end