From 5fb6dd5664a6e46d9c824be0c7ae16d24ac283cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guitaut?= Date: Tue, 10 May 2022 11:38:48 +0200 Subject: [PATCH] DEV: Upgrade to Rails 7.0.3 --- Gemfile | 2 +- Gemfile.lock | 56 ++++++++++++------------ lib/freedom_patches/ar_references_fix.rb | 50 --------------------- 3 files changed, 29 insertions(+), 79 deletions(-) delete mode 100644 lib/freedom_patches/ar_references_fix.rb diff --git a/Gemfile b/Gemfile index bb5d41e03b3..ebacad90a46 100644 --- a/Gemfile +++ b/Gemfile @@ -18,7 +18,7 @@ else # this allows us to include the bits of rails we use without pieces we do not. # # To issue a rails update bump the version number here - rails_version = '7.0.2.4' + rails_version = '7.0.3' gem 'actionmailer', rails_version gem 'actionpack', rails_version gem 'actionview', rails_version diff --git a/Gemfile.lock b/Gemfile.lock index 6000bf36cb7..a2c2160fe3a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,25 +1,25 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (7.0.2.4) - actionpack (= 7.0.2.4) - actionview (= 7.0.2.4) - activejob (= 7.0.2.4) - activesupport (= 7.0.2.4) + actionmailer (7.0.3) + actionpack (= 7.0.3) + actionview (= 7.0.3) + activejob (= 7.0.3) + activesupport (= 7.0.3) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.2.4) - actionview (= 7.0.2.4) - activesupport (= 7.0.2.4) + actionpack (7.0.3) + actionview (= 7.0.3) + activesupport (= 7.0.3) rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actionview (7.0.2.4) - activesupport (= 7.0.2.4) + actionview (7.0.3) + activesupport (= 7.0.3) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -28,15 +28,15 @@ GEM actionview (>= 6.0.a) active_model_serializers (0.8.4) activemodel (>= 3.0) - activejob (7.0.2.4) - activesupport (= 7.0.2.4) + activejob (7.0.3) + activesupport (= 7.0.3) globalid (>= 0.3.6) - activemodel (7.0.2.4) - activesupport (= 7.0.2.4) - activerecord (7.0.2.4) - activemodel (= 7.0.2.4) - activesupport (= 7.0.2.4) - activesupport (7.0.2.4) + activemodel (7.0.3) + activesupport (= 7.0.3) + activerecord (7.0.3) + activemodel (= 7.0.3) + activesupport (= 7.0.3) + activesupport (7.0.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -349,9 +349,9 @@ GEM rails_multisite (4.0.1) activerecord (> 5.0, < 7.1) railties (> 5.0, < 7.1) - railties (7.0.2.4) - actionpack (= 7.0.2.4) - activesupport (= 7.0.2.4) + railties (7.0.3) + actionpack (= 7.0.3) + activesupport (= 7.0.3) method_source rake (>= 12.2) thor (~> 1.0) @@ -509,14 +509,14 @@ PLATFORMS x86_64-linux DEPENDENCIES - actionmailer (= 7.0.2.4) - actionpack (= 7.0.2.4) - actionview (= 7.0.2.4) + actionmailer (= 7.0.3) + actionpack (= 7.0.3) + actionview (= 7.0.3) actionview_precompiler active_model_serializers (~> 0.8.3) - activemodel (= 7.0.2.4) - activerecord (= 7.0.2.4) - activesupport (= 7.0.2.4) + activemodel (= 7.0.3) + activerecord (= 7.0.3) + activesupport (= 7.0.3) addressable annotate aws-sdk-s3 @@ -596,7 +596,7 @@ DEPENDENCIES rack-protection rails_failover rails_multisite - railties (= 7.0.2.4) + railties (= 7.0.3) rake rb-fsevent rbtrace diff --git a/lib/freedom_patches/ar_references_fix.rb b/lib/freedom_patches/ar_references_fix.rb deleted file mode 100644 index ba9db28010c..00000000000 --- a/lib/freedom_patches/ar_references_fix.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -# This patch is a backport of https://github.com/rails/rails/pull/42350 -# It fixes a bug introduced by Rails which affects reference columns marking -# them as integer instead of bigint. -# -# This should be deleted when version 7.0.3 is released. -module FreedomPatches - module ArReferencesFix - module SchemaDefinition - def index_options(table_name) - index_options = as_options(index) - - # legacy reference index names are used on versions 6.0 and earlier - return index_options if options[:_uses_legacy_reference_index_name] - - index_options[:name] ||= polymorphic_index_name(table_name) if polymorphic - index_options - end - - ActiveRecord::ConnectionAdapters::ReferenceDefinition.prepend(self) - end - end -end - -class ActiveRecord::Migration::Compatibility::V6_0 - module TableDefinition - def references(*args, **options) - options[:_uses_legacy_reference_index_name] = true - super - end - alias :belongs_to :references - end - - def add_reference(table_name, ref_name, **options) - if connection.adapter_name == "SQLite" - options[:type] = :integer - end - options[:_uses_legacy_reference_index_name] = true - super - end - alias :add_belongs_to :add_reference - - def compatible_table_definition(t) - class << t - prepend TableDefinition - end - super - end -end