views:

19

answers:

1

Is there a way to write this in the command line that will auto-generate the migration script below?

Example:

ruby script/generate migration renamePostsTableToActicles

Generates:

class RenamePostsTableToActicles < ActiveRecord:Migration
  def self.up
    rename_table :posts, :articles
  end
  def self.down
    rename_table :articles, :posts
  end
end

Like:

ruby script/generate migration addCategoryIdToPosts category_id:integer
+1  A: 

As Rails migrations currently stand (including Rails 3), no, this isn't possible. Unless there is a plugin out there I'm not aware of.

Bill Turner