Skip to content

Commit

Permalink
Merge pull request #125 from zendesk/bquorning/drop-old-rails-versions
Browse files Browse the repository at this point in the history
Drop old Rails versions
  • Loading branch information
bquorning committed Oct 12, 2023
2 parents 00595f2 + 00d34a1 commit 393981d
Show file tree
Hide file tree
Showing 26 changed files with 266 additions and 783 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Expand Up @@ -43,10 +43,6 @@ jobs:
legacy_connection_handling:
- "false"
- "true"
include:
- {ruby-version: "2.7", gemfile: rails5.1, legacy_connection_handling: "false"}
- {ruby-version: "2.7", gemfile: rails5.2, legacy_connection_handling: "false"}
- {ruby-version: "2.7", gemfile: rails6.0, legacy_connection_handling: "false"}
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
LEGACY_CONNECTION_HANDLING: "${{ matrix.legacy_connection_handling }}"
Expand Down
1 change: 1 addition & 0 deletions Changelog.md
Expand Up @@ -8,6 +8,7 @@ and as of v1.0.0 this project adheres to [Semantic Versioning](https://semver.or

- `Trilogy` is now a supported MySQL database adapter. ActiveRecordHostPool no longer requires `mysql2`, nor does it explicitly require `activerecord-trilogy-adapter`. Applications using ARHP will now need to explicitly require one of these adapters in its gemfile. When using `activerecord-trilogy-adapter` also ensure that the `trilogy` gem is locked to `v2.5.0+`.
- Remove `mysql2` as a direct dependency, test Rails 7.0 with `mysql2` and `activerecord-trilogy-adapter`.
- Remove support for Rails 5.1, 5.2, and 6.0.

## [1.2.5] - 2023-07-14
### Added
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
@@ -1,3 +1,3 @@
# frozen_string_literal: true

eval_gemfile 'gemfiles/rails5.1.gemfile'
eval_gemfile 'gemfiles/rails6.1.gemfile'
4 changes: 2 additions & 2 deletions Readme.md
Expand Up @@ -62,11 +62,11 @@ You need a local user called 'john-doe'.

With mysql running locally, run

BUNDLE_GEMFILE=gemfiles/rails5.2.gemfile bundle exec rake test
BUNDLE_GEMFILE=gemfiles/rails6.1.gemfile bundle exec rake test

Or

BUNDLE_GEMFILE=gemfiles/rails5.2.gemfile ruby test/test_arhp.rb --seed 19911 --verbose
BUNDLE_GEMFILE=gemfiles/rails6.1.gemfile ruby test/test_arhp.rb --seed 19911 --verbose

## Copyright

Expand Down
2 changes: 1 addition & 1 deletion active_record_host_pool.gemspec
Expand Up @@ -28,5 +28,5 @@ Gem::Specification.new do |s|

s.required_ruby_version = ">= 2.7.0"

s.add_runtime_dependency("activerecord", ">= 5.1.0", "< 7.1")
s.add_runtime_dependency("activerecord", ">= 6.1.0", "< 7.1")
end
10 changes: 0 additions & 10 deletions gemfiles/rails5.1.gemfile

This file was deleted.

84 changes: 0 additions & 84 deletions gemfiles/rails5.1.gemfile.lock

This file was deleted.

10 changes: 0 additions & 10 deletions gemfiles/rails5.2.gemfile

This file was deleted.

84 changes: 0 additions & 84 deletions gemfiles/rails5.2.gemfile.lock

This file was deleted.

10 changes: 0 additions & 10 deletions gemfiles/rails6.0.gemfile

This file was deleted.

84 changes: 0 additions & 84 deletions gemfiles/rails6.0.gemfile.lock

This file was deleted.

2 changes: 1 addition & 1 deletion gemfiles/rails6.1.gemfile.lock
Expand Up @@ -2,7 +2,7 @@ PATH
remote: ..
specs:
active_record_host_pool (1.2.5)
activerecord (>= 5.1.0, < 7.1)
activerecord (>= 6.1.0, < 7.1)

GEM
remote: https://rubygems.org/
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails7.0_mysql2.gemfile.lock
Expand Up @@ -2,7 +2,7 @@ PATH
remote: ..
specs:
active_record_host_pool (1.2.5)
activerecord (>= 5.1.0, < 7.1)
activerecord (>= 6.1.0, < 7.1)

GEM
remote: https://rubygems.org/
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails7.0_trilogy.gemfile.lock
Expand Up @@ -2,7 +2,7 @@ PATH
remote: ..
specs:
active_record_host_pool (1.2.5)
activerecord (>= 5.1.0, < 7.1)
activerecord (>= 6.1.0, < 7.1)

GEM
remote: https://rubygems.org/
Expand Down
18 changes: 1 addition & 17 deletions lib/active_record_host_pool/clear_query_cache_patch.rb
Expand Up @@ -25,22 +25,6 @@ def clear_on_handler(handler)
end
end
end

# For Rails 6.0.
module ClearQueryCachePatch
def clear_query_caches_for_current_thread
ActiveRecord::Base.connection_handlers.each_value do |handler|
handler.connection_pool_list.each do |pool|
pool._unproxied_connection.clear_query_cache if pool.active_connection?
end
end
end
end
end

case "#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}"
when '6.1', '7.0'
ActiveRecord::Base.singleton_class.prepend(ActiveRecordHostPool::ClearOnHandlerPatch)
when '6.0'
ActiveRecord::Base.singleton_class.prepend(ActiveRecordHostPool::ClearQueryCachePatch)
end
ActiveRecord::Base.singleton_class.prepend(ActiveRecordHostPool::ClearOnHandlerPatch)

0 comments on commit 393981d

Please sign in to comment.