Skip to content

Commit

Permalink
chore: adding support for rails 7.2 dependencies
Browse files Browse the repository at this point in the history
* chore: adding support for rails 7.2 dependencies

* chore: adding ruby 3.3 to the test matrix too

* fix: using specifically the postgres table name quoting implementation, instead of the abstract one that is not available on 7.2 anymore

* fix: tentative include of postgres include only on newer rails versions

* fix: force require the postgres classes before the db connection happens

* fix: continue importing the abstract quoting that is still used for a couple methods

* chore: testing ruby 3.3 with rails 7.1 on CI too

* chore: continue running test matrix if a single scenario fails

* chore: force lazy connection to be established

* fix: using reconnect! that is available on older rails versions too
  • Loading branch information
evsasse authored Aug 19, 2024
1 parent e55e8d5 commit 2f11de3
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -84,7 +87,7 @@ jobs:
- name: Run integration tests simple
run: |
cd integration-specs/simple
bundle exec rspec
bundle exec rspec
integration_rails:
env:
Expand Down Expand Up @@ -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
10 changes: 10 additions & 0 deletions gemfiles/ar_7_2.gemfile
Original file line number Diff line number Diff line change
@@ -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: '../'
136 changes: 136 additions & 0 deletions gemfiles/ar_7_2.gemfile.lock
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions lib/sequent/core/event_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lib/sequent/support/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down

0 comments on commit 2f11de3

Please sign in to comment.