Skip to content

Commit

Permalink
Add support for Rails 7.1 (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrage authored Oct 10, 2023
1 parent 5a6a55c commit af4785f
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 10 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ jobs:
- 13
- 14
- 15
- 16
ruby:
- 3.0
- 3.1
- 3.2
- "3.0"
- "3.1"
- "3.2"
gemfile:
- rails_6.1
- rails_7.0
- rails_7.1
name: PostgreSQL ${{ matrix.pg }} - Ruby ${{ matrix.ruby }} - ${{ matrix.gemfile }}
runs-on: ubuntu-latest
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
Expand Down
11 changes: 9 additions & 2 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
appraise "rails-6.1" do
gem "rails", "6.1.7.4"
gem "rails", "6.1.7.6"
end

appraise "rails-7.0" do
gem "rails", "7.0.7"
gem "rails", "7.0.8"
end

appraise "rails-7.1" do
gem "rails", "7.1.0"

# TODO: remove this once an official version is released
gem "db-query-matchers", git: "https://github.com/jrochkind/db-query-matchers", branch: "allow_rails_7.1"
end
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
build:
context: .
args:
- PGVERSION=${PGVERSION:-15}
- PGVERSION=${PGVERSION:-16}
ports:
- "5432:5432"
environment:
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_6.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

source "https://rubygems.org"

gem "rails", "6.1.7.4"
gem "rails", "6.1.7.6"

gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/rails_7.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

source "https://rubygems.org"

gem "rails", "7.0.7"
gem "rails", "7.0.8"

gemspec path: "../"
8 changes: 8 additions & 0 deletions gemfiles/rails_7.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "7.1.0"
gem "db-query-matchers", git: "https://github.com/jrochkind/db-query-matchers", branch: "allow_rails_7.1"

gemspec path: "../"
2 changes: 1 addition & 1 deletion lib/pg_ha_migrations/allowed_versions.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "active_record/migration/compatibility"

module PgHaMigrations::AllowedVersions
ALLOWED_VERSIONS = [4.2, 5.0, 5.1, 5.2, 6.0, 6.1, 7.0].map do |v|
ALLOWED_VERSIONS = [4.2, 5.0, 5.1, 5.2, 6.0, 6.1, 7.0, 7.1].map do |v|
begin
ActiveRecord::Migration[v]
rescue ArgumentError
Expand Down
2 changes: 1 addition & 1 deletion pg_ha_migrations.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "pry-byebug"
spec.add_development_dependency "appraisal", "~> 2.2.0"

spec.add_dependency "rails", ">= 6.1", "< 7.1"
spec.add_dependency "rails", ">= 6.1", "< 7.2"
spec.add_dependency "relation_to_struct", ">= 1.5.1"
spec.add_dependency "ruby2_keywords"
end
4 changes: 4 additions & 0 deletions spec/safe_statements_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1796,6 +1796,10 @@ def up
end

it "raises error when child index name is too large" do
if ActiveRecord::VERSION::MAJOR >= 7 && ActiveRecord::VERSION::MINOR >= 1
skip "Rails 7.1+ will automatically generate index names less than 63 bytes"
end

create_range_partitioned_table("x" * 43, migration_klass, with_partman: true)

test_migration = Class.new(migration_klass) do
Expand Down

0 comments on commit af4785f

Please sign in to comment.