Kamilski81
Kamilski81

Reputation: 15107

Upgrading from Rails 2.7 to Ruby 3.0 causes issues in schema:load

I'm getting the following error on command line:

$ RAILS_ENV=test bundle exec rake db:schema:load
rake aborted!
ArgumentError: wrong number of arguments (given 3, expected 2)
/Users/kamil/Sites/pz/core/db/schema.rb:1060:in `block in <main>'
/Users/kamil/Sites/pz/core/db/schema.rb:13:in `<main>'
/Users/kamil/.rbenv/versions/3.0.6/bin/bundle:23:in `load'
/Users/kamil/.rbenv/versions/3.0.6/bin/bundle:23:in `<main>'
Tasks: TOP => db:schema:load

It's erroring out on this line:

add_foreign_key "artifacts", "properties", on_update: :cascade

But when I look at the method, it has the following code, and it should be working:

      def add_foreign_key(from_table, to_table, **options)
        return unless supports_foreign_keys?

        options = foreign_key_options(from_table, to_table, options)
        at = create_alter_table from_table
        at.add_foreign_key to_table, options

        execute schema_creation.accept(at)
      end

Upvotes: 0

Views: 79

Answers (1)

Kamilski81
Kamilski81

Reputation: 15107

I upgraded strong_migrations from 0.6.2 to 1.7.0 and this fixed the error.

Upvotes: 0

Related Questions