Skip to content

Commit 8fdbdee

Browse files
committedNov 26, 2024
Add support for Rails 8.0
- Remove Ruby 3.1 from build matrix Closes #109
1 parent 32f71f3 commit 8fdbdee

10 files changed

+33
-12
lines changed
 

‎.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
- 15
1111
- 16
1212
ruby:
13-
- "3.1"
1413
- "3.2"
1514
- "3.3"
1615
gemfile:
1716
- rails_7.0
1817
- rails_7.1
1918
- rails_7.2
19+
- rails_8.0
2020
name: PostgreSQL ${{ matrix.pg }} - Ruby ${{ matrix.ruby }} - ${{ matrix.gemfile }}
2121
runs-on: ubuntu-latest
2222
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps

‎Appraisals

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
appraise "rails-7.0" do
2-
gem "rails", "7.0.8"
2+
gem "rails", "~> 7.0.0"
33
end
44

55
appraise "rails-7.1" do
6-
gem "rails", "7.1.5"
6+
gem "rails", "~> 7.1.0"
77
end
88

99
appraise "rails-7.2" do
10-
gem "rails", "7.2.2"
10+
gem "rails", "~> 7.2.0"
11+
end
12+
13+
appraise "rails-8.0" do
14+
gem "rails", "~> 8.0.0"
1115
end

‎Gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
44

55
# Specify your gem's dependencies in pg_ha_migrations.gemspec
66
gemspec
7-

‎gemfiles/rails_7.0.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
source "https://rubygems.org"
44

5-
gem "rails", "7.0.8"
5+
gem "rails", "~> 7.0.0"
66

77
gemspec path: "../"

‎gemfiles/rails_7.1.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
source "https://rubygems.org"
44

5-
gem "rails", "7.1.5"
5+
gem "rails", "~> 7.1.0"
66

77
gemspec path: "../"

‎gemfiles/rails_7.2.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
source "https://rubygems.org"
44

5-
gem "rails", "7.2.2"
5+
gem "rails", "~> 7.2.0"
66

77
gemspec path: "../"

‎gemfiles/rails_8.0.gemfile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "rails", "~> 8.0.0"
6+
7+
gemspec path: "../"

‎lib/pg_ha_migrations/allowed_versions.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require "active_record/migration/compatibility"
22

33
module PgHaMigrations::AllowedVersions
4-
ALLOWED_VERSIONS = [4.2, 5.0, 5.1, 5.2, 6.0, 6.1, 7.0, 7.1, 7.2].map do |v|
4+
ALLOWED_VERSIONS = [4.2, 5.0, 5.1, 5.2, 6.0, 6.1, 7.0, 7.1, 7.2, 8.0].map do |v|
55
begin
66
ActiveRecord::Migration[v]
77
rescue ArgumentError

‎pg_ha_migrations.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
3737
spec.add_development_dependency "pry-byebug"
3838
spec.add_development_dependency "appraisal", "~> 2.5"
3939

40-
spec.add_dependency "rails", ">= 7.0", "< 7.3"
40+
spec.add_dependency "rails", ">= 7.0", "< 8.1"
4141
spec.add_dependency "relation_to_struct", ">= 1.5.1"
4242
spec.add_dependency "ruby2_keywords"
4343
end

‎spec/safe_statements_spec.rb

+13-2
Original file line numberDiff line numberDiff line change
@@ -2708,7 +2708,13 @@ def up
27082708

27092709
it "doesn't acquire a lock which prevents concurrent reads and writes" do
27102710
alternate_connection_pool = ActiveRecord::ConnectionAdapters::ConnectionPool.new(pool_config)
2711-
alternate_connection = alternate_connection_pool.connection
2711+
2712+
# The #connection method was deprecated in Rails 7.2 in favor of #lease_connection
2713+
alternate_connection = if alternate_connection_pool.respond_to?(:lease_connection)
2714+
alternate_connection_pool.lease_connection
2715+
else
2716+
alternate_connection_pool.connection
2717+
end
27122718

27132719
alternate_connection.execute("BEGIN")
27142720
alternate_connection.execute("LOCK TABLE foos")
@@ -4069,7 +4075,12 @@ def up
40694075
ActiveRecord::ConnectionAdapters::ConnectionPool.new(pool_config)
40704076
end
40714077
let(:alternate_connection) do
4072-
alternate_connection_pool.connection
4078+
# The #connection method was deprecated in Rails 7.2 in favor of #lease_connection
4079+
if alternate_connection_pool.respond_to?(:lease_connection)
4080+
alternate_connection_pool.lease_connection
4081+
else
4082+
alternate_connection_pool.connection
4083+
end
40734084
end
40744085
let(:migration) { Class.new(migration_klass).new }
40754086

0 commit comments

Comments
 (0)
Please sign in to comment.