Project

General

Profile

Feature #36320 » 0001-Upgrade-to-Rails-7.2.0.patch

Takashi Kato, 2024-08-20 01:00

View differences:

Gemfile
2 2

  
3 3
ruby '>= 3.0.0', '< 3.4.0'
4 4

  
5
gem 'rails', '7.1.2'
5
gem 'rails', '7.2.0'
6 6
gem 'rouge', '~> 4.2'
7 7
gem 'mini_mime', '~> 1.1.0'
8 8
gem "actionpack-xml_parser"
app/controllers/admin_controller.rb
78 78
    @checklist = [
79 79
      [:text_default_administrator_account_changed, User.default_admin_account_changed?],
80 80
      [:text_file_repository_writable, File.writable?(Attachment.storage_path)],
81
      [:text_all_migrations_have_been_run, !ActiveRecord::Base.connection.migration_context.needs_migration?],
81
      [:text_all_migrations_have_been_run, !ActiveRecord::Base.connection.pool.migration_context.needs_migration?],
82 82
      [:text_minimagick_available,     Object.const_defined?(:MiniMagick)],
83 83
      [:text_convert_available,        Redmine::Thumbnail.convert_available?],
84 84
      [:text_gs_available,             Redmine::Thumbnail.gs_available?]
lib/redmine/plugin.rb
526 526
          self.current_plugin = plugin
527 527
          return if current_version(plugin) == version
528 528

  
529
          MigrationContext.new(plugin.migration_directory, ::ActiveRecord::Base.connection.schema_migration).migrate(version)
529
          MigrationContext.new(plugin.migration_directory, ::ActiveRecord::Base.connection.pool.schema_migration).migrate(version)
530 530
        end
531 531

  
532 532
        def get_all_versions(plugin = current_plugin)
533 533
          # Delete migrations that don't match .. to_i will work because the number comes first
534 534
          @all_versions ||= {}
535 535
          @all_versions[plugin.id.to_s] ||= begin
536
            sm_table = ::ActiveRecord::Base.connection.schema_migration.table_name
536
            sm_table = ::ActiveRecord::Base.connection.pool.schema_migration.table_name
537 537
            migration_versions  = ActiveRecord::Base.connection.select_values("SELECT version FROM #{sm_table}")
538 538
            versions_by_plugins = migration_versions.group_by {|version| version.match(/-(.*)$/).try(:[], 1)}
539 539
            @all_versions       = versions_by_plugins.transform_values! {|versions| versions.map!(&:to_i).sort!}
test/unit/lib/redmine/plugin_test.rb
234 234
    migration_dir = File.join(@klass.directory, 'db', 'migrate')
235 235

  
236 236
    Redmine::Plugin::Migrator.current_plugin = plugin
237
    context = Redmine::Plugin::MigrationContext.new(migration_dir, ::ActiveRecord::Base.connection.schema_migration)
237
    context = Redmine::Plugin::MigrationContext.new(migration_dir, ::ActiveRecord::Base.connection.pool.schema_migration)
238 238
    # current_version should be zero because Foo plugin has no migration
239 239
    assert_equal 0, context.current_version
240 240
  end
(9-9/13)