diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3be8b474..39293dcd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,17 +10,14 @@ jobs: - ruby: 3.3 gemfile: gemfiles/activerecord72.gemfile postgres: 16 - - ruby: 3.2 + - ruby: 3.3 gemfile: Gemfile - postgres: 15 - - ruby: 3.1 - gemfile: gemfiles/activerecord70.gemfile postgres: 14 - - ruby: "3.0" - gemfile: gemfiles/activerecord61.gemfile + - ruby: 3.2 + gemfile: gemfiles/activerecord70.gemfile postgres: 12 - - ruby: 2.7 - gemfile: gemfiles/activerecord60.gemfile + - ruby: 3.1 + gemfile: gemfiles/activerecord61.gemfile postgres: 10 env: BUNDLE_GEMFILE: ${{ matrix.gemfile }} diff --git a/CHANGELOG.md b/CHANGELOG.md index f4b051d8..1918c5a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.6.0 (unreleased) + +- Dropped support for Ruby < 3.1 and Rails < 6.1 + ## 3.5.0 (2024-05-21) - Added materialized views to space page and `relation_sizes` method diff --git a/gemfiles/activerecord60.gemfile b/gemfiles/activerecord60.gemfile deleted file mode 100644 index e924e1e7..00000000 --- a/gemfiles/activerecord60.gemfile +++ /dev/null @@ -1,12 +0,0 @@ -source "https://rubygems.org" - -gemspec path: ".." - -gem "minitest", ">= 5" -gem "rake" - -gem "activerecord", "~> 6.0.0" -gem "combustion" -gem "pg" -gem "pg_query", "~> 2" -gem "google-protobuf", "< 4" diff --git a/lib/pghero.rb b/lib/pghero.rb index 40affdbe..19c66fef 100644 --- a/lib/pghero.rb +++ b/lib/pghero.rb @@ -243,14 +243,12 @@ def clean_space_stats(before: nil) # private def connection_config(model) - ActiveRecord::VERSION::STRING.to_f >= 6.1 ? model.connection_db_config.configuration_hash : model.connection_config + model.connection_db_config.configuration_hash end # private - # Rails 6.1 deprecates `spec_name` for `name` - # https://github.com/rails/rails/pull/38536 def spec_name_key - ActiveRecord::VERSION::STRING.to_f >= 6.1 ? :name : :spec_name + :name end # private diff --git a/lib/pghero/database.rb b/lib/pghero/database.rb index 9a40b0d4..fa03e89b 100644 --- a/lib/pghero/database.rb +++ b/lib/pghero/database.rb @@ -145,7 +145,7 @@ def build_connection_model config_options = {env_name: PgHero.env, PgHero.spec_name_key => config["spec"], PgHero.include_replicas_key => true} resolved = ActiveRecord::Base.configurations.configs_for(**config_options) raise Error, "Spec not found: #{config["spec"]}" unless resolved - url = ActiveRecord::VERSION::STRING.to_f >= 6.1 ? resolved.configuration_hash : resolved.config + url = resolved.configuration_hash end url = url.dup diff --git a/lib/pghero/methods/basic.rb b/lib/pghero/methods/basic.rb index 87b034bb..9fbe0208 100644 --- a/lib/pghero/methods/basic.rb +++ b/lib/pghero/methods/basic.rb @@ -44,10 +44,8 @@ def select_all(sql, conn: nil, query_columns: []) result = conn.select_all(add_source(squish(sql))) if ActiveRecord::VERSION::MAJOR >= 8 result = result.to_a.map(&:symbolize_keys) - elsif ActiveRecord::VERSION::STRING.to_f >= 6.1 - result = result.map(&:symbolize_keys) else - result = result.map { |row| row.to_h { |col, val| [col.to_sym, result.column_types[col].send(:cast_value, val)] } } + result = result.map(&:symbolize_keys) end if filter_data query_columns.each do |column| diff --git a/pghero.gemspec b/pghero.gemspec index 8925cea3..aeaac6e9 100644 --- a/pghero.gemspec +++ b/pghero.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |spec| spec.files = Dir["*.{md,txt}", "{app,config,lib,licenses}/**/*"] spec.require_path = "lib" - spec.required_ruby_version = ">= 2.7" + spec.required_ruby_version = ">= 3.1" - spec.add_dependency "activerecord", ">= 6" + spec.add_dependency "activerecord", ">= 6.1" end