Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 6.0 Migrations - "ArgumentError: wrong number of arguments (given 2, expected 1)" #85

Open
Cheddah opened this issue Sep 25, 2019 · 1 comment

Comments

@Cheddah
Copy link

Cheddah commented Sep 25, 2019

Hairtrigger version: 0.2.23
Ruby version: 2.6.2
Rails version: 6.0.0.rc1

Whenever I run a migration, it ends with an error (stack trace below):

** Execute db:load_config
** Execute db:migrate
   (12.5ms)  SELECT pg_try_advisory_lock(551766187216958595)
   (13.3ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
  ActiveRecord::InternalMetadata Load (13.8ms)  SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2  [["key", "environment"], ["LIMIT", 1]]
   (12.1ms)  SELECT pg_advisory_unlock(551766187216958595)
** Invoke db:_dump (first_time)
** Execute db:_dump
** Invoke db:schema:dump (first_time)
** Invoke db:load_config
** Invoke environment
** Execute db:schema:dump
   (12.0ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
   (20.8ms)              SELECT tgname::varchar, pg_get_triggerdef(oid, true)
            FROM pg_trigger
            WHERE NOT tgisinternal AND tgconstrrelid = 0 AND tgrelid IN (
              SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = 'public')
            )


            UNION
            SELECT proname || '()', pg_get_functiondef(oid)
            FROM pg_proc
            WHERE (SELECT typname FROM pg_type WHERE oid = prorettype) = 'trigger'            AND oid IN (
              SELECT tgfoid
              FROM pg_trigger
              WHERE NOT tgisinternal AND tgconstrrelid = 0 AND tgrelid IN (
                SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = 'public')
              )
            )



rails aborted!
ArgumentError: wrong number of arguments (given 2, expected 1)
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1019:in `initialize'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/hairtrigger-0.2.23/lib/hair_trigger.rb:44:in `new'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/hairtrigger-0.2.23/lib/hair_trigger.rb:44:in `migrator'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/hairtrigger-0.2.23/lib/hair_trigger.rb:73:in `current_migrations'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/hairtrigger-0.2.23/lib/hair_trigger/schema_dumper.rb:23:in `triggers'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/hairtrigger-0.2.23/lib/hair_trigger/schema_dumper.rb:7:in `trailer'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/activerecord-6.0.0.rc1/lib/active_record/schema_dumper.rb:45:in `dump'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/activerecord-6.0.0.rc1/lib/active_record/schema_dumper.rb:28:in `dump'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/activerecord-6.0.0.rc1/lib/active_record/railties/databases.rake:344:in `block (5 levels) in <main>'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/activerecord-6.0.0.rc1/lib/active_record/railties/databases.rake:342:in `open'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/activerecord-6.0.0.rc1/lib/active_record/railties/databases.rake:342:in `block (4 levels) in <main>'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/activerecord-6.0.0.rc1/lib/active_record/railties/databases.rake:340:in `each'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/activerecord-6.0.0.rc1/lib/active_record/railties/databases.rake:340:in `block (3 levels) in <main>'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:273:in `block in execute'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:273:in `each'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:273:in `execute'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
/Users/mnwani/.rvm/rubies/ruby-2.6.2/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:194:in `invoke_with_call_chain'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:183:in `invoke'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/activerecord-6.0.0.rc1/lib/active_record/railties/databases.rake:92:in `block (2 levels) in <main>'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:273:in `block in execute'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:273:in `each'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:273:in `execute'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
/Users/mnwani/.rvm/rubies/ruby-2.6.2/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:194:in `invoke_with_call_chain'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:183:in `invoke'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/activerecord-6.0.0.rc1/lib/active_record/railties/databases.rake:85:in `block (2 levels) in <main>'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:273:in `block in execute'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:273:in `each'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:273:in `execute'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
/Users/mnwani/.rvm/rubies/ruby-2.6.2/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:194:in `invoke_with_call_chain'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/task.rb:183:in `invoke'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/application.rb:160:in `invoke_task'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/application.rb:116:in `each'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/application.rb:116:in `block in top_level'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/application.rb:125:in `run_with_threads'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/application.rb:110:in `top_level'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/railties-6.0.0.rc1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/rake-12.3.3/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/railties-6.0.0.rc1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/railties-6.0.0.rc1/lib/rails/command.rb:48:in `invoke'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/railties-6.0.0.rc1/lib/rails/commands.rb:18:in `<main>'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:302:in `block in require'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:268:in `load_dependency'
/Users/mnwani/.rvm/gems/ruby-2.6.2/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:302:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:schema:dump

When I remove the hairtrigger gem, the migration is successful (note: I'm not using the gem at all in my migration):

** Execute db:load_config
** Execute db:migrate
   (12.5ms)  SELECT pg_try_advisory_lock(551766187216958595)
   (12.6ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
  ActiveRecord::InternalMetadata Load (15.4ms)  SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2  [["key", "environment"], ["LIMIT", 1]]
   (12.3ms)  SELECT pg_advisory_unlock(551766187216958595)
** Invoke db:_dump (first_time)
** Execute db:_dump
** Invoke db:schema:dump (first_time)
** Invoke db:load_config
** Execute db:schema:dump
   (13.8ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC

Just thought I'd help by alerting this if it's an unknown bug.

@Cheddah Cheddah changed the title Rails 6 - "ArgumentError: wrong number of arguments (given 2, expected 1)" during Migration Rails 6 Migrations - "ArgumentError: wrong number of arguments (given 2, expected 1)" Sep 25, 2019
@Cheddah Cheddah changed the title Rails 6 Migrations - "ArgumentError: wrong number of arguments (given 2, expected 1)" Rails 6.0 Migrations - "ArgumentError: wrong number of arguments (given 2, expected 1)" Sep 25, 2019
@liaden
Copy link

liaden commented Nov 2, 2019

For what it is worth, I updated to rails 6, ran into this issue. I updated the gem seeing https://github.com/jenseng/hair_trigger/pull/83/files is merged, and I don't have this error anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants