Skip to content
This repository

Reversible migrations problem when using arguments (master branch) #4285

Closed
feroult opened this Issue January 03, 2012 · 3 comments

3 participants

Fernando Ultremare Arun Agrawal Toshinori Kajihara
Fernando Ultremare

Hi, seems to be a Rails problem, sorry if it is my mistake.

I'm getting this error when trying to rollback a reversible migration (rails master just updated)

-- drop_table("meses_previsoes", {:id=>false})
rake aborted!
An error has occurred, all later migrations canceled:

wrong number of arguments (2 for 1)

The migration:

class MesesPrevisoes < ActiveRecord::Migration
  def change
    create_table :meses_previsoes, id: false do |t|
      t.integer :mes_id
      t.integer :previsao_id
    end
    add_index(:meses_previsoes, [:mes_id, :previsao_id], unique: true, name: 'meses_previsoes_unique')
  end
end

The complete stack:

$ RAILS_ENV=test rake db:rollback --trace
** Invoke db:rollback (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:rollback
==  MesesPrevisoes: reverting =================================================
-- remove_index("meses_previsoes", {:name=>"meses_previsoes_unique"})
   -> 0.1990s
-- drop_table("meses_previsoes", {:id=>false})
rake aborted!
An error has occurred, all later migrations canceled:

wrong number of arguments (2 for 1)
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb:255:in `drop_table'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:449:in `block in method_missing'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:423:in `block in say_with_time'
/home/fernando/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:423:in `say_with_time'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:443:in `method_missing'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:388:in `block (3 levels) in migrate'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:387:in `each'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:387:in `block (2 levels) in migrate'
/home/fernando/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:386:in `block in migrate'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:151:in `with_connection'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:376:in `migrate'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:511:in `migrate'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:696:in `block (2 levels) in migrate'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:753:in `call'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:753:in `ddl_transaction'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:695:in `block in migrate'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:676:in `each'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:676:in `migrate'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:557:in `down'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:632:in `move'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/migration.rb:545:in `rollback'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails-00c5342d96a3/activerecord/lib/active_record/railties/databases.rake:234:in `block (2 levels) in <top (required)>'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/home/fernando/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/fernando/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
./bin/rake:16:in `load'
./bin/rake:16:in `<main>'
Tasks: TOP => db:rollback
Toshinori Kajihara
Collaborator

@feroult I reproduced this issue. and I fixed this one.
I'll send pull request.

Toshinori Kajihara
Collaborator
Arun Agrawal
Collaborator

Closing this as #4286 is merged.

Thanks!

Arun Agrawal arunagw closed this January 03, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.