Skip to content

Commit

Permalink
Add support for Rails 7.2
Browse files Browse the repository at this point in the history
Co-Authored-By: AlexMooney <[email protected]>
  • Loading branch information
rkrage and AlexMooney committed Nov 25, 2024
1 parent 073789b commit 24c66dc
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- rails_6.1
- rails_7.0
- rails_7.1
- rails_7.2
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
4 changes: 4 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ end
appraise "rails-7.1" do
gem "rails", "7.1.0"
end

appraise "rails-7.2" do
gem "rails", "7.2.2"
end
7 changes: 7 additions & 0 deletions gemfiles/rails_7.2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "7.2.2"

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, 7.1].map do |v|
ALLOWED_VERSIONS = [4.2, 5.0, 5.1, 5.2, 6.0, 6.1, 7.0, 7.1, 7.2].map do |v|
begin
ActiveRecord::Migration[v]
rescue ArgumentError
Expand Down
4 changes: 2 additions & 2 deletions pg_ha_migrations.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rake", ">= 12.3.3"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "pg"
spec.add_development_dependency "db-query-matchers", "~> 0.12.0"
spec.add_development_dependency "db-query-matchers", "~> 0.14"
spec.add_development_dependency "pry"
spec.add_development_dependency "pry-byebug"
spec.add_development_dependency "appraisal", "~> 2.5"

spec.add_dependency "rails", ">= 6.1", "< 7.2"
spec.add_dependency "rails", ">= 6.1", "< 7.3"
spec.add_dependency "relation_to_struct", ">= 1.5.1"
spec.add_dependency "ruby2_keywords"
end
8 changes: 6 additions & 2 deletions spec/safe_statements_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ def pool_config

PgHaMigrations::AllowedVersions::ALLOWED_VERSIONS.each do |migration_klass|
describe migration_klass do
let(:schema_migration) do
ActiveRecord::Base.connection.schema_migration if ActiveRecord::Base.connection.respond_to?(:schema_migration)
end

it "can be used as a migration class" do
expect do
Class.new(migration_klass)
Expand Down Expand Up @@ -123,7 +127,7 @@ def up
# which completely bypasses this logic.
ActiveRecord::MigrationContext.new(
migration_dir,
ActiveRecord::Base.connection.schema_migration,
schema_migration,
).migrate
end
end.to raise_error(StandardError, /An error has occurred, all later migrations canceled/)
Expand Down Expand Up @@ -160,7 +164,7 @@ def up
# which completely bypasses this logic.
ActiveRecord::MigrationContext.new(
migration_dir,
ActiveRecord::Base.connection.schema_migration,
schema_migration,
).migrate
end
end.to raise_error(StandardError, /An error has occurred, this and all later migrations canceled/)
Expand Down

0 comments on commit 24c66dc

Please sign in to comment.