script/generate migration addContentToUsers
That creates a migration with the following:
class AddContentToUsers < ActiveRecord::Migration
def self.up
end
def self.down
end
end
What's generated is pretty green, so we'd have to add some add_column/remove_column statements like so:
class AddContentToUsers < ActiveRecord::Migration
def self.up
add_column :users, :content, :text
end
Lots of not needed work. Why not just enter what we want onto the commandline when we run our migration? Enter the cool generator way of creating a simple migration:
script/generate migration AddContentToUsers content:string
This generates a sweet, simple migration like this:
class AddContentToUsers < ActiveRecord::Migration
def self.up
add_column :users, :content, :string
end
def self.down
remove_column :users, :content
end
end
Hot. Thanks for pointing this out l4rk