From d6bec460a8c568bcb18fad93c5416646d56b9c25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guitaut?= Date: Mon, 19 Aug 2024 14:44:17 +0200 Subject: [PATCH] DEV: Upgrade Rails to version 7.2 --- Gemfile | 14 ++-- Gemfile.lock | 75 +++++++++---------- app/models/application_request.rb | 3 +- app/models/directory_column.rb | 2 +- app/models/post_hotlinked_media.rb | 3 +- app/models/remote_theme.rb | 2 +- app/models/reviewable_history.rb | 4 +- app/models/reviewable_score.rb | 2 +- app/models/theme.rb | 2 +- app/models/topic_tracking_state.rb | 33 ++++---- app/models/translation_override.rb | 2 +- app/models/user_option.rb | 2 +- app/models/web_hook_event_type.rb | 5 +- config/application.rb | 3 +- config/discourse_defaults.conf | 3 + config/initializers/002-freedom_patches.rb | 5 +- config/initializers/002-rails_failover.rb | 2 +- config/initializers/100-flags.rb | 2 +- .../rails_rack_logger_from_rails_7_2.rb | 58 -------------- lib/tasks/db.rake | 4 +- plugins/poll/app/models/poll.rb | 14 ++-- ...ull.rb => 20230309014015_drop_not_null.rb} | 0 ..._table.rb => 20230309014014_drop_table.rb} | 0 ...umn.rb => 20230309014014_remove_column.rb} | 0 ...umn.rb => 20230309014014_rename_column.rb} | 0 ...able.rb => 20230309014014_rename_table.rb} | 0 ...s.rb => 20230309014015_drop_email_logs.rb} | 0 ...rb => 20230309014014_drop_post_columns.rb} | 0 ...> 20230309014013_drop_email_logs_table.rb} | 0 spec/lib/migration/safe_migrate_spec.rb | 4 +- 30 files changed, 93 insertions(+), 151 deletions(-) delete mode 100644 lib/freedom_patches/rails_rack_logger_from_rails_7_2.rb rename spec/fixtures/db/migrate/drop_not_null/{20990309014015_drop_not_null.rb => 20230309014015_drop_not_null.rb} (100%) rename spec/fixtures/db/migrate/drop_table/{20990309014014_drop_table.rb => 20230309014014_drop_table.rb} (100%) rename spec/fixtures/db/migrate/remove_column/{20990309014014_remove_column.rb => 20230309014014_remove_column.rb} (100%) rename spec/fixtures/db/migrate/rename_column/{20990309014014_rename_column.rb => 20230309014014_rename_column.rb} (100%) rename spec/fixtures/db/migrate/rename_table/{20990309014014_rename_table.rb => 20230309014014_rename_table.rb} (100%) rename spec/fixtures/db/post_migrate/change/{20990309014015_drop_email_logs.rb => 20230309014015_drop_email_logs.rb} (100%) rename spec/fixtures/db/post_migrate/drop_column/{20990309014014_drop_post_columns.rb => 20230309014014_drop_post_columns.rb} (100%) rename spec/fixtures/db/post_migrate/drop_table/{20990309014013_drop_email_logs_table.rb => 20230309014013_drop_email_logs_table.rb} (100%) diff --git a/Gemfile b/Gemfile index f467dc75496..bdb7e1134d2 100644 --- a/Gemfile +++ b/Gemfile @@ -6,13 +6,13 @@ source "https://rubygems.org" gem "bootsnap", require: false, platform: :mri -gem "actionmailer", "~> 7.1.0" -gem "actionpack", "~> 7.1.0" -gem "actionview", "~> 7.1.0" -gem "activemodel", "~> 7.1.0" -gem "activerecord", "~> 7.1.0" -gem "activesupport", "~> 7.1.0" -gem "railties", "~> 7.1.0" +gem "actionmailer", "~> 7.2.0" +gem "actionpack", "~> 7.2.0" +gem "actionview", "~> 7.2.0" +gem "activemodel", "~> 7.2.0" +gem "activerecord", "~> 7.2.0" +gem "activesupport", "~> 7.2.0" +gem "railties", "~> 7.2.0" gem "sprockets-rails" gem "json" diff --git a/Gemfile.lock b/Gemfile.lock index 05da11c4993..2dbda85bd90 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,28 +1,26 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (7.1.5) - actionpack (= 7.1.5) - actionview (= 7.1.5) - activejob (= 7.1.5) - activesupport (= 7.1.5) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp + actionmailer (7.2.2) + actionpack (= 7.2.2) + actionview (= 7.2.2) + activejob (= 7.2.2) + activesupport (= 7.2.2) + mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.1.5) - actionview (= 7.1.5) - activesupport (= 7.1.5) + actionpack (7.2.2) + actionview (= 7.2.2) + activesupport (= 7.2.2) nokogiri (>= 1.8.5) racc - rack (>= 2.2.4) + rack (>= 2.2.4, < 3.2) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actionview (7.1.5) - activesupport (= 7.1.5) + useragent (~> 0.16) + actionview (7.2.2) + activesupport (= 7.2.2) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) @@ -31,28 +29,27 @@ GEM actionview (>= 6.0.a) active_model_serializers (0.8.4) activemodel (>= 3.0) - activejob (7.1.5) - activesupport (= 7.1.5) + activejob (7.2.2) + activesupport (= 7.2.2) globalid (>= 0.3.6) - activemodel (7.1.5) - activesupport (= 7.1.5) - activerecord (7.1.5) - activemodel (= 7.1.5) - activesupport (= 7.1.5) + activemodel (7.2.2) + activesupport (= 7.2.2) + activerecord (7.2.2) + activemodel (= 7.2.2) + activesupport (= 7.2.2) timeout (>= 0.4.0) - activesupport (7.1.5) + activesupport (7.2.2) base64 benchmark (>= 0.3) bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) logger (>= 1.4.2) minitest (>= 5.1) - mutex_m securerandom (>= 0.3) - tzinfo (~> 2.0) + tzinfo (~> 2.0, >= 2.0.5) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) annotate (3.2.0) @@ -263,7 +260,6 @@ GEM multi_xml (0.7.1) bigdecimal (~> 3.1) mustache (1.1.1) - mutex_m (0.3.0) net-http (0.5.0) uri net-imap (0.5.1) @@ -363,7 +359,7 @@ GEM rack (< 3) rack-test (2.1.0) rack (>= 1.3) - rackup (1.0.0) + rackup (1.0.1) rack (< 3) webrick rails-dom-testing (2.2.0) @@ -380,10 +376,10 @@ GEM rails_multisite (6.1.0) activerecord (>= 6.0) railties (>= 6.0) - railties (7.1.5) - actionpack (= 7.1.5) - activesupport (= 7.1.5) - irb + railties (7.2.2) + actionpack (= 7.2.2) + activesupport (= 7.2.2) + irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) @@ -571,6 +567,7 @@ GEM raindrops (~> 0.7) uniform_notifier (1.16.0) uri (1.0.2) + useragent (0.16.10) version_gem (1.1.4) web-push (3.0.1) jwt (~> 2.0) @@ -603,14 +600,14 @@ PLATFORMS x86_64-linux DEPENDENCIES - actionmailer (~> 7.1.0) - actionpack (~> 7.1.0) - actionview (~> 7.1.0) + actionmailer (~> 7.2.0) + actionpack (~> 7.2.0) + actionview (~> 7.2.0) actionview_precompiler active_model_serializers (~> 0.8.3) - activemodel (~> 7.1.0) - activerecord (~> 7.1.0) - activesupport (~> 7.1.0) + activemodel (~> 7.2.0) + activerecord (~> 7.2.0) + activesupport (~> 7.2.0) addressable annotate aws-sdk-s3 @@ -699,7 +696,7 @@ DEPENDENCIES rails-dom-testing rails_failover rails_multisite - railties (~> 7.1.0) + railties (~> 7.2.0) rake rb-fsevent rbtrace diff --git a/app/models/application_request.rb b/app/models/application_request.rb index b471314a1a0..9b605493423 100644 --- a/app/models/application_request.rb +++ b/app/models/application_request.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true class ApplicationRequest < ActiveRecord::Base - enum req_type: { + enum :req_type, + { http_total: 0, http_2xx: 1, http_background: 2, diff --git a/app/models/directory_column.rb b/app/models/directory_column.rb index d13dd26b5d1..561b3a3cd8d 100644 --- a/app/models/directory_column.rb +++ b/app/models/directory_column.rb @@ -4,7 +4,7 @@ class DirectoryColumn < ActiveRecord::Base self.ignored_columns = ["automatic"] # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy self.inheritance_column = nil - enum type: { automatic: 0, user_field: 1, plugin: 2 }, _scopes: false + enum :type, { automatic: 0, user_field: 1, plugin: 2 }, scopes: false def self.automatic_column_names @automatic_column_names ||= %i[ diff --git a/app/models/post_hotlinked_media.rb b/app/models/post_hotlinked_media.rb index 53477bf7563..a692a7d92e0 100644 --- a/app/models/post_hotlinked_media.rb +++ b/app/models/post_hotlinked_media.rb @@ -3,7 +3,8 @@ class PostHotlinkedMedia < ActiveRecord::Base belongs_to :post belongs_to :upload - enum status: { + enum :status, + { downloaded: "downloaded", too_large: "too_large", download_failed: "download_failed", diff --git a/app/models/remote_theme.rb b/app/models/remote_theme.rb index 1025017973b..959ed3764e4 100644 --- a/app/models/remote_theme.rb +++ b/app/models/remote_theme.rb @@ -417,7 +417,7 @@ class RemoteTheme < ActiveRecord::Base self.commits_behind = 0 end - transaction_block = -> do + transaction_block = ->(*) do # Destroy fields that no longer exist in the remote theme field_ids_to_destroy = theme.theme_fields.pluck(:id) - updated_fields.map { |tf| tf&.id } ThemeField.where(id: field_ids_to_destroy).destroy_all diff --git a/app/models/reviewable_history.rb b/app/models/reviewable_history.rb index b5df88cb421..14b2569ec31 100644 --- a/app/models/reviewable_history.rb +++ b/app/models/reviewable_history.rb @@ -4,10 +4,10 @@ class ReviewableHistory < ActiveRecord::Base belongs_to :reviewable belongs_to :created_by, class_name: "User" - enum status: { pending: 0, approved: 1, rejected: 2, ignored: 3, deleted: 4 } + enum :status, { pending: 0, approved: 1, rejected: 2, ignored: 3, deleted: 4 } alias_attribute :type, :reviewable_history_type - enum type: { created: 0, transitioned: 1, edited: 2, claimed: 3, unclaimed: 4 } + enum :type, { created: 0, transitioned: 1, edited: 2, claimed: 3, unclaimed: 4 } end # == Schema Information diff --git a/app/models/reviewable_score.rb b/app/models/reviewable_score.rb index af34a428ed3..a52e0f097db 100644 --- a/app/models/reviewable_score.rb +++ b/app/models/reviewable_score.rb @@ -6,7 +6,7 @@ class ReviewableScore < ActiveRecord::Base belongs_to :reviewed_by, class_name: "User" belongs_to :meta_topic, class_name: "Topic" - enum status: { pending: 0, agreed: 1, disagreed: 2, ignored: 3 } + enum :status, { pending: 0, agreed: 1, disagreed: 2, ignored: 3 } # To keep things simple the types correspond to `PostActionType` for backwards # compatibility, but we can add extra reasons for scores. diff --git a/app/models/theme.rb b/app/models/theme.rb index 6b3e05fb487..a95d88ee547 100644 --- a/app/models/theme.rb +++ b/app/models/theme.rb @@ -863,7 +863,7 @@ class Theme < ActiveRecord::Base end def migrate_settings(start_transaction: true, fields: nil, allow_out_of_sequence_migration: false) - block = -> do + block = ->(*) do runner = ThemeSettingsMigrationsRunner.new(self) results = runner.run(fields:, raise_error_on_out_of_sequence: !allow_out_of_sequence_migration) diff --git a/app/models/topic_tracking_state.rb b/app/models/topic_tracking_state.rb index 770ded22e4e..446cdcc3640 100644 --- a/app/models/topic_tracking_state.rb +++ b/app/models/topic_tracking_state.rb @@ -238,31 +238,34 @@ class TopicTrackingState end def self.new_filter_sql - TopicQuery - .new_filter(Topic, treat_as_new_topic_clause_sql: treat_as_new_topic_clause) - .where_clause - .ast - .to_sql + " AND topics.created_at > :min_new_topic_date" + - " AND dismissed_topic_users.id IS NULL" + ActiveRecord::Base.connection.to_sql( + TopicQuery + .new_filter(Topic, treat_as_new_topic_clause_sql: treat_as_new_topic_clause) + .where_clause + .ast, + ) + " AND topics.created_at > :min_new_topic_date" + " AND dismissed_topic_users.id IS NULL" end def self.unread_filter_sql(whisperer: false) - TopicQuery.unread_filter(Topic, whisperer: whisperer).where_clause.ast.to_sql + ActiveRecord::Base.connection.to_sql( + TopicQuery.unread_filter(Topic, whisperer: whisperer).where_clause.ast, + ) end def self.treat_as_new_topic_clause - User - .where( - "GREATEST(CASE + ActiveRecord::Base.connection.to_sql( + User + .where( + "GREATEST(CASE WHEN COALESCE(uo.new_topic_duration_minutes, :default_duration) = :always THEN u.created_at WHEN COALESCE(uo.new_topic_duration_minutes, :default_duration) = :last_visit THEN COALESCE(u.previous_visit_at,u.created_at) ELSE (:now::timestamp - INTERVAL '1 MINUTE' * COALESCE(uo.new_topic_duration_minutes, :default_duration)) END, u.created_at, :min_date)", - treat_as_new_topic_params, - ) - .where_clause - .ast - .to_sql + treat_as_new_topic_params, + ) + .where_clause + .ast, + ) end def self.treat_as_new_topic_params diff --git a/app/models/translation_override.rb b/app/models/translation_override.rb index bca5bbaeb96..c6c45ef8c80 100644 --- a/app/models/translation_override.rb +++ b/app/models/translation_override.rb @@ -52,7 +52,7 @@ class TranslationOverride < ActiveRecord::Base validate :check_MF_string, if: :message_format? attribute :status, :integer - enum status: { up_to_date: 0, outdated: 1, invalid_interpolation_keys: 2, deprecated: 3 } + enum :status, { up_to_date: 0, outdated: 1, invalid_interpolation_keys: 2, deprecated: 3 } scope :mf_locales, ->(locale) { not_deprecated.where(locale: locale).where("translation_key LIKE '%_MF'") } diff --git a/app/models/user_option.rb b/app/models/user_option.rb index 1cdf09d6fd9..9983feeae5d 100644 --- a/app/models/user_option.rb +++ b/app/models/user_option.rb @@ -26,7 +26,7 @@ class UserOption < ActiveRecord::Base scope :human_users, -> { where("user_id > 0") } - enum default_calendar: { none_selected: 0, ics: 1, google: 2 }, _scopes: false + enum :default_calendar, { none_selected: 0, ics: 1, google: 2 }, scopes: false def self.ensure_consistency! sql = <<~SQL diff --git a/app/models/web_hook_event_type.rb b/app/models/web_hook_event_type.rb index 2a9ac2067bb..e518c1dbb16 100644 --- a/app/models/web_hook_event_type.rb +++ b/app/models/web_hook_event_type.rb @@ -18,7 +18,8 @@ class WebHookEventType < ActiveRecord::Base TOPIC_VOTING = 17 CHAT_MESSAGE = 18 - enum group: { + enum :group, + { topic: 0, post: 1, user: 2, @@ -37,7 +38,7 @@ class WebHookEventType < ActiveRecord::Base chat: 15, custom: 16, }, - _scopes: false + scopes: false TYPES = { topic_created: 101, diff --git a/config/application.rb b/config/application.rb index e81b230d93d..1c0245ea40e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -90,7 +90,8 @@ module Discourse # tiny file needed by site settings require "highlight_js" - config.load_defaults 7.1 + config.load_defaults 7.2 + config.yjit = GlobalSetting.yjit_enabled config.active_record.cache_versioning = false # our custom cache class doesn’t support this config.action_controller.forgery_protection_origin_check = false config.active_record.belongs_to_required_by_default = false diff --git a/config/discourse_defaults.conf b/config/discourse_defaults.conf index e8ad28e2c58..8e7e0aeaa51 100644 --- a/config/discourse_defaults.conf +++ b/config/discourse_defaults.conf @@ -405,3 +405,6 @@ log_line_max_chars = 160000 # Updating the value will allow site operators to invalidate all asset urls # to recover from configuration issues which may have been cached by CDNs/browsers. asset_url_salt = + +# Enable Ruby YJIT to get better performances at the cost of using more memory. +yjit_enabled = false diff --git a/config/initializers/002-freedom_patches.rb b/config/initializers/002-freedom_patches.rb index c042f6febe2..b957e037114 100644 --- a/config/initializers/002-freedom_patches.rb +++ b/config/initializers/002-freedom_patches.rb @@ -2,10 +2,7 @@ # Multisite freedom patch defines RailsMultisite::DiscoursePatches.config which is used by 200-first_middlewares.rb # Therefore it can not be postponed with .to_prepare -RUN_WITHOUT_PREPARE = [ - "#{Rails.root}/lib/freedom_patches/rails_multisite.rb", - "#{Rails.root}/lib/freedom_patches/rails_rack_logger_from_rails_7_2.rb", -] +RUN_WITHOUT_PREPARE = ["#{Rails.root}/lib/freedom_patches/rails_multisite.rb"] RUN_WITHOUT_PREPARE.each { |path| require(path) } Rails.application.reloader.to_prepare do diff --git a/config/initializers/002-rails_failover.rb b/config/initializers/002-rails_failover.rb index d43a24334ac..9b158963521 100644 --- a/config/initializers/002-rails_failover.rb +++ b/config/initializers/002-rails_failover.rb @@ -44,7 +44,7 @@ if defined?(RailsFailover::ActiveRecord) # Test connection to the master, and trigger master failover if needed ActiveRecord::Base.connected_to(role: ActiveRecord.writing_role) do - ActiveRecord::Base.connection.active? + ActiveRecord::Base.connection.connect!.active? rescue PG::ConnectionBad, PG::UnableToSend, PG::ServerError RailsFailover::ActiveRecord.verify_primary(ActiveRecord.writing_role) end diff --git a/config/initializers/100-flags.rb b/config/initializers/100-flags.rb index 17311b5190e..01bdeea1943 100644 --- a/config/initializers/100-flags.rb +++ b/config/initializers/100-flags.rb @@ -3,7 +3,7 @@ # On initialize, reset flags cache Rails.application.config.to_prepare do if Discourse.cache.is_a?(Cache) && - !ActiveRecord::Base.connection.migration_context.needs_migration? + !ActiveRecord::Base.connection_pool.migration_context.needs_migration? Flag.reset_flag_settings! end end diff --git a/lib/freedom_patches/rails_rack_logger_from_rails_7_2.rb b/lib/freedom_patches/rails_rack_logger_from_rails_7_2.rb deleted file mode 100644 index a616f012161..00000000000 --- a/lib/freedom_patches/rails_rack_logger_from_rails_7_2.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -# TODO: Drop this patch when upgrading to Rails 7.2 -# -# Here we use the code from Rails 7.2 because the code from Rails 7.1 has a -# nasty bug that happens when there is more than one tagged logger in the -# broadcast logger. -# The Rails 7.1 implementation calls `#call_app` as many times as there are -# tagged loggers, which leads to all sort of strange behaviors. -module RailsRackLoggerFromRails7_2 - extend ActiveSupport::Concern - - def call(env) - request = ActionDispatch::Request.new(env) - - env["rails.rack_logger_tag_count"] = if logger.respond_to?(:push_tags) - logger.push_tags(*compute_tags(request)).size - else - 0 - end - - call_app(request, env) - end - - private - - def call_app(request, env) # :doc: - logger_tag_pop_count = env["rails.rack_logger_tag_count"] - - instrumenter = ActiveSupport::Notifications.instrumenter - handle = instrumenter.build_handle("request.action_dispatch", { request: request }) - handle.start - - logger.info { started_request_message(request) } - status, headers, body = response = @app.call(env) - body = - ::Rack::BodyProxy.new(body) { finish_request_instrumentation(handle, logger_tag_pop_count) } - - if response.frozen? - [status, headers, body] - else - response[2] = body - response - end - rescue Exception - finish_request_instrumentation(handle, logger_tag_pop_count) - raise - end - - def finish_request_instrumentation(handle, logger_tag_pop_count) - handle.finish - if logger.respond_to?(:pop_tags) && logger_tag_pop_count > 0 - logger.pop_tags(logger_tag_pop_count) - end - ActiveSupport::LogSubscriber.flush_all! - end -end -Rails::Rack::Logger.prepend(RailsRackLoggerFromRails7_2) diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index ecae4705b9b..3abc3e5a520 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -70,7 +70,7 @@ end task "db:rollback" => %w[environment set_locale] do |_, args| step = ENV["STEP"] ? ENV["STEP"].to_i : 1 - ActiveRecord::Base.connection.migration_context.rollback(step) + ActiveRecord::Base.connection_pool.migration_context.rollback(step) Rake::Task["db:_dump"].invoke end @@ -236,7 +236,7 @@ task "db:migrate" => %w[ redis: Discourse.redis.without_namespace, validity: 300, ) do - migrations = ActiveRecord::Base.connection.migration_context.migrations + migrations = ActiveRecord::Base.connection_pool.migration_context.migrations now_timestamp = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i epoch_timestamp = Time.at(0).utc.strftime("%Y%m%d%H%M%S").to_i diff --git a/plugins/poll/app/models/poll.rb b/plugins/poll/app/models/poll.rb index de645ac9d7b..f9ab6674fab 100644 --- a/plugins/poll/app/models/poll.rb +++ b/plugins/poll/app/models/poll.rb @@ -9,15 +9,11 @@ class Poll < ActiveRecord::Base has_many :poll_options, -> { order(:id) }, dependent: :destroy has_many :poll_votes - enum type: { regular: 0, multiple: 1, number: 2, ranked_choice: 3 }, _scopes: false - - enum status: { open: 0, closed: 1 }, _scopes: false - - enum results: { always: 0, on_vote: 1, on_close: 2, staff_only: 3 }, _scopes: false - - enum visibility: { secret: 0, everyone: 1 }, _scopes: false - - enum chart_type: { bar: 0, pie: 1 }, _scopes: false + enum :type, { regular: 0, multiple: 1, number: 2, ranked_choice: 3 }, scopes: false + enum :status, { open: 0, closed: 1 }, scopes: false + enum :results, { always: 0, on_vote: 1, on_close: 2, staff_only: 3 }, scopes: false + enum :visibility, { secret: 0, everyone: 1 }, scopes: false + enum :chart_type, { bar: 0, pie: 1 }, scopes: false validates :min, numericality: { allow_nil: true, only_integer: true, greater_than_or_equal_to: 0 } validates :max, numericality: { allow_nil: true, only_integer: true, greater_than: 0 } diff --git a/spec/fixtures/db/migrate/drop_not_null/20990309014015_drop_not_null.rb b/spec/fixtures/db/migrate/drop_not_null/20230309014015_drop_not_null.rb similarity index 100% rename from spec/fixtures/db/migrate/drop_not_null/20990309014015_drop_not_null.rb rename to spec/fixtures/db/migrate/drop_not_null/20230309014015_drop_not_null.rb diff --git a/spec/fixtures/db/migrate/drop_table/20990309014014_drop_table.rb b/spec/fixtures/db/migrate/drop_table/20230309014014_drop_table.rb similarity index 100% rename from spec/fixtures/db/migrate/drop_table/20990309014014_drop_table.rb rename to spec/fixtures/db/migrate/drop_table/20230309014014_drop_table.rb diff --git a/spec/fixtures/db/migrate/remove_column/20990309014014_remove_column.rb b/spec/fixtures/db/migrate/remove_column/20230309014014_remove_column.rb similarity index 100% rename from spec/fixtures/db/migrate/remove_column/20990309014014_remove_column.rb rename to spec/fixtures/db/migrate/remove_column/20230309014014_remove_column.rb diff --git a/spec/fixtures/db/migrate/rename_column/20990309014014_rename_column.rb b/spec/fixtures/db/migrate/rename_column/20230309014014_rename_column.rb similarity index 100% rename from spec/fixtures/db/migrate/rename_column/20990309014014_rename_column.rb rename to spec/fixtures/db/migrate/rename_column/20230309014014_rename_column.rb diff --git a/spec/fixtures/db/migrate/rename_table/20990309014014_rename_table.rb b/spec/fixtures/db/migrate/rename_table/20230309014014_rename_table.rb similarity index 100% rename from spec/fixtures/db/migrate/rename_table/20990309014014_rename_table.rb rename to spec/fixtures/db/migrate/rename_table/20230309014014_rename_table.rb diff --git a/spec/fixtures/db/post_migrate/change/20990309014015_drop_email_logs.rb b/spec/fixtures/db/post_migrate/change/20230309014015_drop_email_logs.rb similarity index 100% rename from spec/fixtures/db/post_migrate/change/20990309014015_drop_email_logs.rb rename to spec/fixtures/db/post_migrate/change/20230309014015_drop_email_logs.rb diff --git a/spec/fixtures/db/post_migrate/drop_column/20990309014014_drop_post_columns.rb b/spec/fixtures/db/post_migrate/drop_column/20230309014014_drop_post_columns.rb similarity index 100% rename from spec/fixtures/db/post_migrate/drop_column/20990309014014_drop_post_columns.rb rename to spec/fixtures/db/post_migrate/drop_column/20230309014014_drop_post_columns.rb diff --git a/spec/fixtures/db/post_migrate/drop_table/20990309014013_drop_email_logs_table.rb b/spec/fixtures/db/post_migrate/drop_table/20230309014013_drop_email_logs_table.rb similarity index 100% rename from spec/fixtures/db/post_migrate/drop_table/20990309014013_drop_email_logs_table.rb rename to spec/fixtures/db/post_migrate/drop_table/20230309014013_drop_email_logs_table.rb diff --git a/spec/lib/migration/safe_migrate_spec.rb b/spec/lib/migration/safe_migrate_spec.rb index 9fe91b84e9f..fcdae52b76b 100644 --- a/spec/lib/migration/safe_migrate_spec.rb +++ b/spec/lib/migration/safe_migrate_spec.rb @@ -13,8 +13,8 @@ RSpec.describe Migration::SafeMigrate do ActiveRecord::Migrator.new( :up, migrations, - ActiveRecord::Base.connection.schema_migration, - ActiveRecord::Base.connection.internal_metadata, + ActiveRecord::Base.connection_pool.schema_migration, + ActiveRecord::Base.connection_pool.internal_metadata, migrations.first.version, ).run end