From 7fbe80ad56c145a6688b6467da46752226617024 Mon Sep 17 00:00:00 2001 From: Evandro Sasse Date: Wed, 1 Jan 2025 09:24:49 -0300 Subject: [PATCH 1/3] activerecord 8 doesn't have legacy_connection_handling anymore --- lib/sequent/support/database.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sequent/support/database.rb b/lib/sequent/support/database.rb index 1a9fc7ff..c17ba690 100644 --- a/lib/sequent/support/database.rb +++ b/lib/sequent/support/database.rb @@ -49,7 +49,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 From 1e6265816c6a48a04b82554d794bec793313ec2a Mon Sep 17 00:00:00 2001 From: Evandro Sasse Date: Wed, 1 Jan 2025 10:08:51 -0300 Subject: [PATCH 2/3] gemfile and ci for activerecord 8 --- .github/workflows/rspec.yml | 2 + README.md | 3 +- gemfiles/ar_8_0.gemfile | 10 +++ gemfiles/ar_8_0.gemfile.lock | 157 +++++++++++++++++++++++++++++++++++ 4 files changed, 171 insertions(+), 1 deletion(-) 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 11e33797..2084b88a 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -21,6 +21,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 48ad82c4..c18394cf 100644 --- a/README.md +++ b/README.md @@ -42,11 +42,12 @@ 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_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..9bc5642e --- /dev/null +++ b/gemfiles/ar_8_0.gemfile.lock @@ -0,0 +1,157 @@ +PATH + remote: .. + specs: + sequent (8.0.1) + activemodel (>= 7.1.3) + activerecord (>= 7.1.3) + bcrypt (~> 3.1) + csv (~> 3.3) + gli (~> 2.22) + 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) + tty-prompt (~> 0.23.1) + 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) + gli (2.22.0) + 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 + pastel (0.8.0) + tty-color (~> 0.5) + pg (1.5.9) + postgresql_cursor (0.6.9) + activerecord (>= 6.0) + prop_check (1.0.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.68.0) + 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.4, < 3.0) + rubocop-ast (>= 1.32.2, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.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) + tty-color (0.6.0) + tty-cursor (0.7.1) + tty-prompt (0.23.1) + pastel (~> 0.8) + tty-reader (~> 0.8) + tty-reader (0.9.0) + tty-cursor (~> 0.7) + tty-screen (~> 0.8) + wisper (~> 2.0) + tty-screen (0.8.2) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (2.6.0) + uri (1.0.2) + wisper (2.0.1) + +PLATFORMS + arm64-darwin-23 + ruby + +DEPENDENCIES + activemodel (= 8.0.1) + activerecord (= 8.0.1) + prop_check (~> 1.0) + pry (~> 0.13) + rake (~> 13) + rspec (~> 3.10) + rspec-collection_matchers (~> 1.2) + rspec-mocks (~> 3.10) + rubocop (~> 1.68.0) + sequent! + simplecov (~> 0.21) + timecop (~> 0.9) + +BUNDLED WITH + 2.5.3 From 3b33a52cbc6b41bda99d8b43507633745b273ab1 Mon Sep 17 00:00:00 2001 From: Evandro Sasse Date: Thu, 2 Jan 2025 08:19:07 -0300 Subject: [PATCH 3/3] remove legacy_connection_handling logic for unsupported activerecord < 7.1 --- lib/sequent/support/database.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/sequent/support/database.rb b/lib/sequent/support/database.rb index c17ba690..28cf3c33 100644 --- a/lib/sequent/support/database.rb +++ b/lib/sequent/support/database.rb @@ -49,9 +49,6 @@ 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 - ActiveRecord.legacy_connection_handling = false - end ActiveRecord::Base.configurations = db_config.stringify_keys ActiveRecord::Base.connects_to database: { Sequent.configuration.primary_database_role => Sequent.configuration.primary_database_key,