Forum: Ruby on Rails [2.2.2]Migration failing because MySQL has no "each" method?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9a94a317786c77f8b31f001917aa3ebc?d=identicon&s=25 Robert Kosek (robert_k)
on 2009-03-09 21:12
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:in `columns'
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:in `send'
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:in `say_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:in `say_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:in
`up_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:in `migrate'
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:in `migrate'
(__DELEGATION__):2:in `__send__'
(__DELEGATION__):2:in `migrate'
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:in `call'
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:in `migrate'
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:in `migrate'
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:in `migrate'
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:in
`execute'
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:in
`execute'
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:in `synchronize'
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:in
`invoke'
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:in
`top_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:in
`top_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:in
`top_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:in
`standard_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:in `load'
C:/Utils/Ruby/bin/rake:19
9a94a317786c77f8b31f001917aa3ebc?d=identicon&s=25 Robert Kosek (robert_k)
on 2009-03-09 21:46
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.
This topic is locked and can not be replied to.