Skip to content

Commit

Permalink
Add support for rails 8 (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
codez authored Nov 28, 2024
1 parent 22828df commit 2579692
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 40 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ jobs:
- mysql
gemfile:
- Gemfile
- spec/ci/rails72.gemfile
- spec/ci/rails71.gemfile
- spec/ci/rails70.gemfile
exclude:
- gemfile: Gemfile
- ruby-version: "3.1"

services:
postgresql:
Expand Down
65 changes: 33 additions & 32 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,36 @@ PATH
remote: .
specs:
validates_by_schema (0.5.2)
activerecord (>= 6.0.0)
activerecord (>= 7.0.0)

GEM
remote: https://rubygems.org/
specs:
actionpack (7.2.1.2)
actionview (= 7.2.1.2)
activesupport (= 7.2.1.2)
actionpack (8.0.0)
actionview (= 8.0.0)
activesupport (= 8.0.0)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4, < 3.2)
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
actionview (7.2.1.2)
activesupport (= 7.2.1.2)
actionview (8.0.0)
activesupport (= 8.0.0)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activemodel (7.2.1.2)
activesupport (= 7.2.1.2)
activerecord (7.2.1.2)
activemodel (= 7.2.1.2)
activesupport (= 7.2.1.2)
activemodel (8.0.0)
activesupport (= 8.0.0)
activerecord (8.0.0)
activemodel (= 8.0.0)
activesupport (= 8.0.0)
timeout (>= 0.4.0)
activesupport (7.2.1.2)
activesupport (8.0.0)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
Expand All @@ -41,7 +41,9 @@ GEM
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
base64 (0.2.0)
benchmark (0.4.0)
bigdecimal (3.1.8)
builder (3.3.0)
concurrent-ruby (1.3.4)
Expand All @@ -61,43 +63,42 @@ GEM
loofah (2.23.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mini_portile2 (2.8.7)
minitest (5.25.1)
mini_portile2 (2.8.8)
minitest (5.25.2)
mysql2 (0.5.6)
nokogiri (1.16.7)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
pg (1.5.9)
psych (5.1.2)
psych (5.2.0)
stringio
racc (1.8.1)
rack (3.1.8)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
rack (>= 1.3)
rackup (2.1.0)
rackup (2.2.1)
rack (>= 3)
webrick (~> 1.8)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.2.1.2)
actionpack (= 7.2.1.2)
activesupport (= 7.2.1.2)
railties (8.0.0)
actionpack (= 8.0.0)
activesupport (= 8.0.0)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rake (13.2.1)
rdoc (6.7.0)
rdoc (6.8.1)
psych (>= 4.0.0)
reline (0.5.10)
reline (0.5.12)
io-console (~> 0.5)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
Expand All @@ -107,7 +108,7 @@ GEM
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (7.0.1)
rspec-rails (7.1.0)
actionpack (>= 7.0)
activesupport (>= 7.0)
railties (>= 7.0)
Expand All @@ -116,7 +117,7 @@ GEM
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.1)
securerandom (0.3.1)
securerandom (0.3.2)
shoulda-matchers (6.4.0)
activesupport (>= 5.2.0)
simplecov (0.22.0)
Expand All @@ -126,16 +127,16 @@ GEM
simplecov-html (0.13.1)
simplecov-lcov (0.8.0)
simplecov_json_formatter (0.1.4)
sqlite3 (1.7.3)
sqlite3 (2.3.1)
mini_portile2 (~> 2.8.0)
stringio (3.1.1)
stringio (3.1.2)
thor (1.3.2)
timeout (0.4.1)
timeout (0.4.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uri (1.0.2)
useragent (0.16.10)
webrick (1.8.2)
zeitwerk (2.6.18)
zeitwerk (2.7.1)

PLATFORMS
ruby
Expand All @@ -148,7 +149,7 @@ DEPENDENCIES
shoulda-matchers
simplecov
simplecov-lcov
sqlite3 (< 2.0)
sqlite3
validates_by_schema!

BUNDLED WITH
Expand Down
7 changes: 1 addition & 6 deletions lib/validates_by_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ def define_schema_validations
end

def fetch_unique_indexes
if connection.schema_cache.respond_to?(:indexes)
connection.schema_cache.indexes(table_name).select(&:unique)
else
# Rails < 6.0
connection.indexes(table_name).select(&:unique)
end
connection.schema_cache.indexes(table_name).select(&:unique)
end

def customized_schema_validatable_columns
Expand Down
2 changes: 2 additions & 0 deletions spec/ci/rails70.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ source 'https://rubygems.org'

gemspec path: '../..'

gem 'sqlite3', '< 2.0'

gem 'simplecov', require: false
gem 'simplecov-lcov', require: false

Expand Down
2 changes: 2 additions & 0 deletions spec/ci/rails71.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ source 'https://rubygems.org'

gemspec path: '../..'

gem 'sqlite3', '< 2.0'

gem 'simplecov', require: false
gem 'simplecov-lcov', require: false

Expand Down
10 changes: 10 additions & 0 deletions spec/ci/rails72.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
source 'https://rubygems.org'

gemspec path: '../..'

gem 'sqlite3', '< 2.0'

gem 'simplecov', require: false
gem 'simplecov-lcov', require: false

gem 'activerecord', '~> 7.2.0'
4 changes: 2 additions & 2 deletions validates_by_schema.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ Gem::Specification.new do |s|
s.test_files = Dir['spec/**/*']
s.require_paths = ['lib']

s.add_dependency 'activerecord', '>= 6.0.0'
s.add_dependency 'activerecord', '>= 7.0.0'

s.add_development_dependency 'mysql2'
s.add_development_dependency 'pg'
s.add_development_dependency 'rake'
s.add_development_dependency 'rspec-rails'
s.add_development_dependency 'shoulda-matchers'
s.add_development_dependency 'sqlite3', '< 2.0' # for the moment
s.add_development_dependency 'sqlite3'
end

0 comments on commit 2579692

Please sign in to comment.