From e93b507211757d950d2a3d0d295c54f153d8f971 Mon Sep 17 00:00:00 2001 From: Evandro Sasse Date: Fri, 3 Jan 2025 07:13:46 -0300 Subject: [PATCH] support activerecord 8 on sequent 7.x --- .github/workflows/rspec.yml | 2 + README.md | 3 +- gemfiles/ar_8_0.gemfile | 10 +++ gemfiles/ar_8_0.gemfile.lock | 141 ++++++++++++++++++++++++++++++++ lib/sequent/support/database.rb | 2 +- 5 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 gemfiles/ar_8_0.gemfile create mode 100644 gemfiles/ar_8_0.gemfile.lock diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index a238d8f1..32813b31 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -20,6 +20,8 @@ jobs: strategy: matrix: include: + - ruby-version: 3.4 + gemfile: 'ar_8_0' - ruby-version: 3.3 gemfile: 'ar_7_2' - ruby-version: 3.3 diff --git a/README.md b/README.md index 29afff2c..115ebb1e 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Ensure the version in `lib/version.rb` is the new version. If not change it and Then run `rake release`. A git tag will be created and pushed, and the new version of the gem will be pushed to rubygems. -Increase version to new working version, update the sequent version for all the `gemfiles`: +Increase version to new working version, update the sequent version for all the `gemfiles`: ``` BUNDLE_GEMFILE=gemfiles/ar_6_0.gemfile bundle update sequent --conservative @@ -50,6 +50,7 @@ BUNDLE_GEMFILE=gemfiles/ar_6_1.gemfile bundle update sequent --conservative BUNDLE_GEMFILE=gemfiles/ar_7_0.gemfile bundle update sequent --conservative BUNDLE_GEMFILE=gemfiles/ar_7_1.gemfile bundle update sequent --conservative BUNDLE_GEMFILE=gemfiles/ar_7_2.gemfile bundle update sequent --conservative +BUNDLE_GEMFILE=gemfiles/ar_8_0.gemfile bundle update sequent --conservative ``` ## Running the specs diff --git a/gemfiles/ar_8_0.gemfile b/gemfiles/ar_8_0.gemfile new file mode 100644 index 00000000..86ecc277 --- /dev/null +++ b/gemfiles/ar_8_0.gemfile @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' + +active_star_version = '= 8.0.1' + +gem 'activemodel', active_star_version +gem 'activerecord', active_star_version + +gemspec path: '../' diff --git a/gemfiles/ar_8_0.gemfile.lock b/gemfiles/ar_8_0.gemfile.lock new file mode 100644 index 00000000..af3a6dc5 --- /dev/null +++ b/gemfiles/ar_8_0.gemfile.lock @@ -0,0 +1,141 @@ +PATH + remote: .. + specs: + sequent (7.2.1) + activemodel (>= 6.0) + activerecord (>= 6.0) + bcrypt (~> 3.1) + csv (~> 3.3) + i18n + logger (~> 1.6) + oj (~> 3.3) + parallel (~> 1.20) + parser (>= 2.6.5, < 3.4) + pg (~> 1.2) + postgresql_cursor (~> 0.6) + thread_safe (~> 0.3.6) + tzinfo (>= 1.1) + +GEM + remote: https://rubygems.org/ + specs: + activemodel (8.0.1) + activesupport (= 8.0.1) + activerecord (8.0.1) + activemodel (= 8.0.1) + activesupport (= 8.0.1) + timeout (>= 0.4.0) + activesupport (8.0.1) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + ast (2.4.2) + base64 (0.2.0) + bcrypt (3.1.20) + benchmark (0.4.0) + bigdecimal (3.1.9) + coderay (1.1.3) + concurrent-ruby (1.3.4) + connection_pool (2.4.1) + csv (3.3.2) + diff-lcs (1.5.1) + docile (1.4.1) + drb (2.2.1) + i18n (1.14.6) + concurrent-ruby (~> 1.0) + json (2.9.1) + language_server-protocol (3.17.0.3) + logger (1.6.4) + method_source (1.1.0) + minitest (5.25.4) + oj (3.16.9) + bigdecimal (>= 3.0) + ostruct (>= 0.2) + ostruct (0.6.1) + parallel (1.26.3) + parser (3.3.6.0) + ast (~> 2.4.1) + racc + pg (1.5.9) + postgresql_cursor (0.6.9) + activerecord (>= 6.0) + pry (0.15.2) + coderay (~> 1.1) + method_source (~> 1.0) + racc (1.8.1) + rainbow (3.1.1) + rake (13.2.1) + regexp_parser (2.10.0) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-collection_matchers (1.2.1) + rspec-expectations (>= 2.99.0.beta1) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.2) + rubocop (1.69.2) + json (~> 2.3) + language_server-protocol (>= 3.17.0) + parallel (~> 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.36.2, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.37.0) + parser (>= 3.3.1.0) + ruby-progressbar (1.13.0) + securerandom (0.4.1) + simplecov (0.22.0) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.13.1) + simplecov_json_formatter (0.1.4) + thread_safe (0.3.6) + timecop (0.9.10) + timeout (0.4.3) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (3.1.3) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) + uri (1.0.2) + +PLATFORMS + arm64-darwin-23 + ruby + +DEPENDENCIES + activemodel (= 8.0.1) + activerecord (= 8.0.1) + pry (~> 0.13) + rake (~> 13) + rspec (~> 3.10) + rspec-collection_matchers (~> 1.2) + rspec-mocks (~> 3.10) + rubocop (~> 1.56, >= 1.56.3) + sequent! + simplecov (~> 0.21) + timecop (~> 0.9) + +BUNDLED WITH + 2.5.3 diff --git a/lib/sequent/support/database.rb b/lib/sequent/support/database.rb index 115c0f59..162536c1 100644 --- a/lib/sequent/support/database.rb +++ b/lib/sequent/support/database.rb @@ -53,7 +53,7 @@ def self.establish_connection(db_config, db_config_overrides = {}) db_config = db_config.deep_merge( Sequent.configuration.primary_database_key => db_config_overrides, ).stringify_keys - if ActiveRecord::VERSION::MAJOR >= 7 && ActiveRecord::VERSION::MINOR < 1 + if ActiveRecord::VERSION::MAJOR == 7 && ActiveRecord::VERSION::MINOR < 1 ActiveRecord.legacy_connection_handling = false end ActiveRecord::Base.configurations = db_config.stringify_keys