Reputation: 36349
I've never had anything but success w/ Rails migrations, so this one is especially perplexing to me. I have a migration that I just wrote, it's fairly simple, but when I try and run it (for the first time, or after rolling back and trying again), there is no output to the console for a few seconds, the job ends, and no change has occurred to my DB, other than checking rake db:migrate:status will show the migration has run (or, it thinks it has).
Migration code is here:
class AddNotesToCases < ActiveRecord::Migration
def up
add_column :cases, :notes, :text
end
def down
remove_column :cases, :notes
end
end
db is PostGres, Rails is 3.0.9, rake is 0.9.2.2
EDIT ** per request, the results of a trace on the rake call are:
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
FWIW, I also have tried rewriting the migration to use a String instead of Text datatype, and also have tried using the def change rather than up/down. No joy on any of them.
Upvotes: 1
Views: 945
Reputation: 19048
The author must have been using Rails version prior to 3.1 because after that singleton methods were no longer needed.
Upvotes: 0
Reputation: 36349
Gah, ok, after re-generating the file from scratch I realized when going from the change
version to the up/down version, I'd typeoed the methods and forgot the 'self' on them. :|
def self.up
worked where my code didn't.
Upvotes: 1