[2.2.2]Migration failing because MySQL has no "each" method?


#1

Hey all.

I’m trying to do a simple migration, but the MySQL adapter keeps
choking. This used to work before, and was just fine before my latest
OS reformat. I’ve got libmysql.dll in Ruby’s /bin directory, and most
the other migrations work well. This migration dies on a
“rename_column” call.

I’m calling:

rename_column :users, :password, :hashed_password

In the self.up method. The table Users exists and has the field
“password”. If I manually migrate this event and add the key into the
database for that, so it will finish my migrations (it’s in the middle
that it’s failing!) I am told that it isn’t synchronized and it won’t
finish generating a schema.

I don’t know what to do, what to edit, or even what is broken … and
I’m deploying this week. This is about to drive me up the wall.

Thank you for any help, tips, or suggestions in advance. I can produce
the migrations if necessary, but they’re a very simple set of migrations
and they were working just a month ago. I haven’t changed a thing since
then (until I revised a template just today) due to a lockdown.

This is my first Rails app an I’m already getting a little discouraged
at these strange errors.

My gems:

actionmailer (2.2.2)
actionpack (2.2.2)
activerecord (2.2.2)
activeresource (2.2.2)
activesupport (2.2.2)
BlueCloth (1.0.0)
capistrano (2.5.5)
cgi_multipart_eof_fix (2.5.0)
diff-lcs (1.1.2)
gem_plugin (0.2.3)
grit (1.0.1)
haml (2.0.9, 2.0.8, 2.0.7)
highline (1.5.0)
maruku (0.5.9)
mime-types (1.16, 1.15)
mongrel (1.1.5)
mysql (2.7.3)
net-scp (1.0.2)
net-sftp (2.0.2)
net-ssh (2.0.11)
net-ssh-gateway (1.0.1)
polyglot (0.2.5, 0.2.4)
pony (0.3)
rack (0.9.1)
rails (2.2.2)
rake (0.8.4, 0.8.3)
RedCloth (4.1.9, 4.1.1)
rubypants (0.2.0)
schacon-git (1.0.7)
sequel (2.11.0, 2.10.0)
sinatra (0.9.1, 0.9.0.4)
syntax (1.0.0)
tmail (1.2.3.1)
treetop (1.2.4)
WikiCreole (0.1.3)


rake db:migrate --trace

** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== RenamePasswordToHashed: migrating

– rename_column(:users, :password, :hashed_password)
rake aborted!
An error has occurred, all later migrations canceled:

undefined method each' for #<Mysql:0x4841af8> C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connec tion_adapters/mysql_adapter.rb:440:incolumns’
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connec
tion_adapters/mysql_adapter.rb:485:in rename_column' C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migrat ion.rb:346:insend’
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migrat
ion.rb:346:in method_missing' C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migrat ion.rb:326:insay_with_time’
C:/Utils/Ruby/lib/ruby/1.8/benchmark.rb:293:in measure' C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migrat ion.rb:326:insay_with_time’
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migrat
ion.rb:342:in method_missing' ./db/migrate//20081121194833_rename_password_to_hashed.rb:3:inup_without_bench
marks’
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migrat
ion.rb:280:in send' C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migrat ion.rb:280:inmigrate’
C:/Utils/Ruby/lib/ruby/1.8/benchmark.rb:293:in measure' C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migrat ion.rb:280:inmigrate’
(DELEGATION):2:in __send__' (__DELEGATION__):2:inmigrate’
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migrat
ion.rb:480:in migrate' C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migrat ion.rb:556:incall’
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migrat
ion.rb:556:in ddl_transaction' C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migrat ion.rb:479:inmigrate’
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migrat
ion.rb:466:in each' C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migrat ion.rb:466:inmigrate’
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migrat
ion.rb:394:in up' C:/Utils/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migrat ion.rb:377:inmigrate’
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:111
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in
call' C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:inexecute’
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in
each' C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:inexecute’
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:in
invoke_with_ call_chain' C:/Utils/Ruby/lib/ruby/1.8/monitor.rb:242:insynchronize’
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in
invoke_with_ call_chain' C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:ininvoke’
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2027:in
invoke_task ' C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:intop_level’
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
each' C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:intop_level’
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in
standard_ex ception_handling' C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1999:intop_level’
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1977:in
run' C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:instandard_ex
ception_handling’
C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1974:in
run' C:/Utils/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake:31 C:/Utils/Ruby/bin/rake:19:inload’
C:/Utils/Ruby/bin/rake:19


#2

I forgot to mention that because of the “undefined method `each’ for
#Mysql:0x4841af8” exception I cannot even use the command, “rake
db:schema:load” because it fails on the first table with this command.
I suspect there’s a flaw in the version of my MySQL gem, but I’ll be
darned if I know what version to revert to.