Update SchemaCacheWithRenamedTable to be compatible with Rails 7.1
SchemaCacheWithRenamedTable
overrides some methods in ActiveRecord::ConnectionAdapters::SchemaCache
.
In 7.1, the method parameters in ActiveRecord::ConnectionAdapters::SchemaCache
has been changed to add connection
as the first parameter. It was (table_name)
and now it is (connection, table_name)
.
- https://github.com/rails/rails/blob/v7.1.0/activerecord/lib/active_record/connection_adapters/schema_cache.rb
- diff 7.0.8 -> 7.1.0
This is preventing Rails from booting up.
Check the Rails upgrade guide at https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#new-activesupport-cache-serialization-format
for more information on how to upgrade.
(called from new at /Users/albert/Dev/gdk-rails-7-1/gitlab/lib/gitlab/redis/feature_flag.rb:15)
/Users/albert/Dev/gdk-rails-7-1/gitlab/lib/gitlab/database/schema_cache_with_renamed_table.rb:28:in `columns_hash': wrong number of arguments (given 2, expected 1) (ArgumentError)
from /Users/albert/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-7.1.0/lib/active_record/connection_adapters/schema_cache.rb:58:in `columns_hash'
from /Users/albert/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-7.1.0/lib/active_record/connection_adapters/schema_cache.rb:188:in `columns_hash'
from /Users/albert/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-7.1.0/lib/active_record/model_schema.rb:616:in `load_schema!'
from /Users/albert/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-7.1.0/lib/active_record/attributes.rb:264:in `load_schema!'
from /Users/albert/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-7.1.0/lib/active_record/encryption/encryptable_record.rb:127:in `load_schema!'
from /Users/albert/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-7.1.0/lib/active_record/model_schema.rb:561:in `block in load_schema'
from /Users/albert/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-7.1.0/lib/active_record/model_schema.rb:558:in `synchronize'
from /Users/albert/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-7.1.0/lib/active_record/model_schema.rb:558:in `load_schema'
from /Users/albert/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-7.1.0/lib/active_record/model_schema.rb:423:in `columns_hash'
from /Users/albert/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-7.1.0/lib/active_record/inheritance.rb:88:in `descends_from_active_record?'
from /Users/albert/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-7.1.0/lib/active_record/inheritance.rb:94:in `finder_needs_type_condition?'
from /Users/albert/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-7.1.0/lib/active_record/core.rb:391:in `relation'
from /Users/albert/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-7.1.0/lib/active_record/scoping/named.rb:45:in `default_scoped'
from /Users/albert/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-7.1.0/lib/active_record/scoping/named.rb:32:in `all'
from /Users/albert/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-7.1.0/lib/active_record/querying.rb:23:in `where'
Rails upgrade guide at https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#new-activesupport-cache-serialization-format
Edited by Albert