Add Migration in Edge not adding requested columns

I decided to just test the new feature in edge (and soon to be in Rails 2.1) where migrations are created using a UTC timestamp instead of a number.

In a test project, where I've done a rake rails:freeze:edge, I did:

ruby script/generate migration AddCourse title:string

and it created a migration file: db/migrate/20080402130730_add_course.rb

but all it contains is:

class AddCourse < ActiveRecord::Migration   def self.up   end

  def self.down   end end

It doesn't seem to want to automatically add the bits about creating the table and adding the columns.

Am I doing something wrong? I did a quick search through the Rails Trac, but didn't see anything.

Thanks,

jt

Isn't that syntax normally reserved for script/generate model?

Julian.

Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) NEW VIDEO
(#2) OUT NOW! http://sensei.zenunit.com/

Julian Leviston wrote:

Isn't that syntax normally reserved for script/generate model?

Julian.

Using that syntax with script/generate model or script/generate resource does indeed create the proper file. However according to the help for script/generate migration, it implies that it should also work:

Description:     Stubs out a new database migration. Pass the migration name, either     CamelCased or under_scored, and an optional list of attribute pairs as argum ents.

    A migration class is generated in db/migrate prefixed by the latest migratio n number.

    You can name your migration in either of these formats to generate add/remov e     column lines from supplied attributes: AddColumnsToTable or RemoveColumnsFro mTable

Example:     `./script/generate migration AddSslFlag`

    With 4 existing migrations, this creates the AddSslFlag migration in     db/migrate/005_add_ssl_flag.rb

    `./script/generate migration AddTitleBodyToPost title:string body:text publi shed:boolean`

    This will create the AddTitleBodyToPost in db/migrate/005_add_title_body_to_ post.rb with     this in the Up migration:

      add_column :posts, :title, :string       add_column :posts, :body, :text       add_column :posts, :published, :boolean

    And this in the Down migration:

      remove_column :posts, :published       remove_column :posts, :body       remove_column :posts, :title

I too have run into this problem. Has anyone confirmed that this is a defect?

Although it never mentions creating a table; it only discusses AddColumnsToTable & RemoveColumnsFromTable. If you look at the code, it's not failing to recognise migrations like CreateFoos, it's just not even trying at all.

Fred