migration with data

Hi
  I am using postgres and have two migration files like
001_create_categories.rb as
class CreateCategories < ActiveRecord::Migration
def self.up
   create_table :categories do |t|
      t.column :name, :string, :limit=>80
   end
end

def self.down
   drop_table :categories
end
end
and 002_populate_categories.rb

class PopulateCategories < ActiveRecord::Migration
execute 'ALTER SEQUENCE categories_id_seq RESTART WITH 100;'
NAMES = ["Category 1", "Category 2", "Category 3"]
def self.up
       NAMES.each{|name| Category.create(:name => name)}
end

def self.down
       NAMES.each{|name| Category.find_by_name(name).destroy}
end

Move that execute into the self.up method: where it currently is, it
is executed when the file is loaded. Since ActiveRecord loads all the
migrations to run up front it will run that execute before migration
1 as run.

Fred

Hi
   Thanks for your reply
Sijo