diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index 5a66b34b..d5ef4404 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -19,8 +19,11 @@ jobs: build: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: include: + - ruby-version: 3.3 + gemfile: 'ar_7_2' - ruby-version: 3.2 gemfile: 'ar_7_1' - ruby-version: 3.2 @@ -84,7 +87,7 @@ jobs: - name: Run integration tests simple run: | cd integration-specs/simple - bundle exec rspec + bundle exec rspec integration_rails: env: @@ -119,4 +122,3 @@ jobs: bundle exec rake sequent:db:create_event_store bundle exec rake sequent:db:create_view_schema bundle exec rspec spec - diff --git a/gemfiles/ar_7_2.gemfile b/gemfiles/ar_7_2.gemfile new file mode 100644 index 00000000..41b2d151 --- /dev/null +++ b/gemfiles/ar_7_2.gemfile @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' + +active_star_version = '= 7.2.0' + +gem 'activemodel', active_star_version +gem 'activerecord', active_star_version + +gemspec path: '../' diff --git a/gemfiles/ar_7_2.gemfile.lock b/gemfiles/ar_7_2.gemfile.lock new file mode 100644 index 00000000..2c485e27 --- /dev/null +++ b/gemfiles/ar_7_2.gemfile.lock @@ -0,0 +1,136 @@ +PATH + remote: .. + specs: + sequent (7.0.1) + activemodel (>= 6.0) + activerecord (>= 6.0) + bcrypt (~> 3.1) + i18n + oj (~> 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 (7.2.0) + activesupport (= 7.2.0) + activerecord (7.2.0) + activemodel (= 7.2.0) + activesupport (= 7.2.0) + timeout (>= 0.4.0) + activesupport (7.2.0) + base64 + 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) + ast (2.4.2) + base64 (0.2.0) + bcrypt (3.1.20) + bigdecimal (3.1.8) + coderay (1.1.3) + concurrent-ruby (1.3.4) + connection_pool (2.4.1) + diff-lcs (1.5.1) + docile (1.4.1) + drb (2.2.1) + i18n (1.14.5) + concurrent-ruby (~> 1.0) + json (2.7.2) + language_server-protocol (3.17.0.3) + logger (1.6.0) + method_source (1.1.0) + minitest (5.25.1) + oj (3.16.5) + bigdecimal (>= 3.0) + ostruct (>= 0.2) + ostruct (0.6.0) + parallel (1.26.3) + parser (3.3.4.2) + ast (~> 2.4.1) + racc + pg (1.5.7) + postgresql_cursor (0.6.9) + activerecord (>= 6.0) + pry (0.14.2) + coderay (~> 1.1) + method_source (~> 1.0) + racc (1.8.1) + rainbow (3.1.1) + rake (13.2.1) + regexp_parser (2.9.2) + rexml (3.3.5) + strscan + 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.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.1) + rubocop (1.65.1) + 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) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.31.1, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.32.0) + parser (>= 3.3.1.0) + ruby-progressbar (1.13.0) + securerandom (0.3.1) + simplecov (0.22.0) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) + strscan (3.1.0) + thread_safe (0.3.6) + timecop (0.9.10) + timeout (0.4.1) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (2.5.0) + +PLATFORMS + arm64-darwin-23 + ruby + +DEPENDENCIES + activemodel (= 7.2.0) + activerecord (= 7.2.0) + 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/core/event_store.rb b/lib/sequent/core/event_store.rb index c21ac2f3..a044addc 100644 --- a/lib/sequent/core/event_store.rb +++ b/lib/sequent/core/event_store.rb @@ -8,6 +8,11 @@ module Sequent module Core class EventStore include ActiveRecord::ConnectionAdapters::Quoting + if Gem.loaded_specs['activerecord'].version >= Gem::Version.create('7.2.0') + require 'active_record/connection_adapters/postgresql_adapter' + include ActiveRecord::ConnectionAdapters::PostgreSQL::Quoting::ClassMethods + end + extend Forwardable class OptimisticLockingError < RuntimeError diff --git a/lib/sequent/support/database.rb b/lib/sequent/support/database.rb index 115c0f59..ddcdd77a 100644 --- a/lib/sequent/support/database.rb +++ b/lib/sequent/support/database.rb @@ -64,6 +64,8 @@ def self.establish_connection(db_config, db_config_overrides = {}) db_config = db_config.merge(db_config_overrides) ActiveRecord::Base.establish_connection(db_config) end + + ActiveRecord::Base.connection.reconnect! end def self.disconnect!