Complete Migration
Listing 1. Modify the migration script for creating a database table and populating it with data. ![]() class CreateCatalogs < ActiveRecord::Migration def self.up create_table :catalogs do |t| t.column :journal, :string, :limit => 255 t.column :publisher, :string, :limit => 255 t.column :edition, :string, :limit => 255 t.column :title, :string, :limit => 255 t.column :author, :string, :limit => 255 end Catalog.create :journal => "developerWorks", :publisher => "IBM", :edition => "September 2006", :title=> "A PHP V5 migration guide",:author=> "Jack D. Herrington" Catalog.create :journal => "developerWorks", :publisher => "IBM", :edition => "September 2006", :title=> "Make Ruby on Rails Easy with RadRails and Eclipse", :author=>"Pat Eyler" end def self.down drop_table :catalogs end end |