Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ActiveRecord/Rails 8.0 #438

Merged
merged 3 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions gemfiles/ar_8_0.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 = '= 8.0.1'

gem 'activemodel', active_star_version
gem 'activerecord', active_star_version

gemspec path: '../'
157 changes: 157 additions & 0 deletions gemfiles/ar_8_0.gemfile.lock
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion lib/sequent/support/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

@evsasse evsasse Jan 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main change I needed to make it work here for now... Still exploring it a bit deeper against our own app.

And running the tests on this repo with ActiveRecord 8.x also confirm this issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We no longer support ActiveRecord before 7.1 so I think this if can be completely removed?

Copy link
Contributor Author

@evsasse evsasse Jan 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense... Done ✅

ActiveRecord.legacy_connection_handling = false
end
ActiveRecord::Base.configurations = db_config.stringify_keys
Expand Down
Loading