add to migration not working (Rails 2.0.2)

I just tried the exact same and it worked for me, i wonder if ur
schema/db is in a bad state. Try:-

rake db:migrate:reset

Then try running the migrations again.

Dave Amos wrote:

Yes, that worked, though it wiped the contents of my db, as well. No
biggie, though. Thanks!

Jabbslad wrote:

Ah sorry should have mentioned that :wink:

"rake db:migrate:redo" might have done the trick and still kept the
data in ur db.

Have a glance at some of the rake tasks for your project (rake -T).
theres loads of them that should help if u ever have the prob again :slight_smile:

Glad prob is solved now though.

Jabbslad

I'm experiencing the same issue. script/generate migration is stubbing
the migration, minus the column info that i'm specifying. Here's what
I did in the Terminal:

$ ruby script/generate migration AddPrimaryPlatformInfo os:string
hardware:string
      exists db/migrate
      create db/migrate/005_add_primary_platform_info.rb

My 005_add_primary_platform_info.rb file then has:

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

  def self.down
  end
end

I can add it manually, but shouldn't we have some add_column and
remove_column goodness added here already?

Tried rake:db:redo and rake:db:reset - neither helped. Any suggestions
from this point on would be greatly appreciated.

Cheers,
Joe

You have to name it "Add(x)To(y)", so AddPrimaryPlatformInfoToMachines
or some such.

Otherwise Rails doesn't know which table to add the columns to. :slight_smile:

--Jeremy

I'm experiencing the same issue. script/generate migration is stubbing
the migration, minus the column info that i'm specifying. Here's what
I did in the Terminal:

$ ruby script/generate migration AddPrimaryPlatformInfo os:string
hardware:string
      exists db/migrate
      create db/migrate/005_add_primary_platform_info.rb

My 005_add_primary_platform_info.rb file then has:

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

  def self.down
  end
end

LOL - got it! Thanks!!

I woke up this morning and realized I was omitting the obvious "To"
part... :wink:

Dang- this thing works perfectly.

-Joe

I thought calling db:migrate was supposed to automatically update the
model.