class BuildDb < ActiveRecord::Migration
  def self.up
    
    create_table :books do |t|
      t.column :name, :string
      t.column :description, :text
    end
    
    create_table :inserts do |t|
      t.column :name, :string
    end
    
    create_table :books_inserts, :id => false do |t|
      t.column :book_id, :integer
      t.column :insert_id, :integer
    end

    Insert.create :name => 'Kupon O\'Reilly'
    Insert.create :name => 'Kupon Borders'
    Insert.create :name => 'Kupon Amazon'
  end

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