activerecord-nulldb-adapter 1.1.1 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +19 -29
- data/Appraisals +4 -0
- data/CHANGES.md +10 -1
- data/Gemfile +1 -1
- data/README.md +2 -6
- data/activerecord-nulldb-adapter.gemspec +1 -1
- data/gemfiles/activerecord_6.1.gemfile +1 -0
- data/gemfiles/activerecord_7.0.gemfile +1 -0
- data/gemfiles/activerecord_8.0.gemfile +1 -1
- data/gemfiles/{activerecord_6.0.gemfile → activerecord_8.1.gemfile} +2 -1
- data/lib/active_record/connection_adapters/nulldb_adapter/core.rb +45 -10
- data/lib/active_record/connection_adapters/nulldb_adapter/table_definition.rb +2 -1
- data/lib/nulldb/version.rb +1 -1
- data/spec/nulldb_spec.rb +13 -4
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d96aa93ee94ff8e5066079bc5a1109013411dae9daa1e9b4ad3006c376cde011
|
|
4
|
+
data.tar.gz: 95f8ba73a83564f08990b90e21caa482dc486f9435092c91eff452b6a376c663
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8a69a0503e3b4b5a2fc57359c76f7227f22663575af4cb3c786da9a0cea42164b91f5009307733e2aacf420bf32e2be105c9f9ed12bfd06c8fd1604de247c6f7
|
|
7
|
+
data.tar.gz: c6ac3b7d961fc2cb68279201987cbeb9143d79bdc66a62984f1df97fa4cf04f295c136192e3d0c4ccd7e8da91784cd884438b11aad5001f9fade65294fb61444
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -12,58 +12,48 @@ jobs:
|
|
|
12
12
|
activerecord_7.1,
|
|
13
13
|
activerecord_7.2,
|
|
14
14
|
activerecord_8.0,
|
|
15
|
+
activerecord_8.1,
|
|
15
16
|
activerecord_master,
|
|
16
17
|
]
|
|
17
|
-
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3", "jruby-9.
|
|
18
|
+
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3", "3.4", "jruby-9.4", "jruby-10"]
|
|
18
19
|
exclude:
|
|
19
|
-
- ruby: "
|
|
20
|
+
- ruby: "3.4"
|
|
21
|
+
gemfile: "activerecord_6.1"
|
|
22
|
+
- ruby: "3.4"
|
|
20
23
|
gemfile: "activerecord_7.0"
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
- ruby: "jruby-9.4"
|
|
25
|
+
gemfile: "activerecord_7.1"
|
|
26
|
+
- ruby: "3.4"
|
|
23
27
|
gemfile: "activerecord_7.1"
|
|
24
|
-
|
|
25
28
|
- ruby: "2.7"
|
|
26
29
|
gemfile: "activerecord_7.2"
|
|
27
|
-
|
|
28
|
-
- ruby: "2.8"
|
|
29
|
-
gemfile: "activerecord_7.2"
|
|
30
|
-
|
|
31
30
|
- ruby: "3.0"
|
|
32
31
|
gemfile: "activerecord_7.2"
|
|
33
|
-
|
|
34
|
-
- ruby: "jruby-9.3.1.0"
|
|
35
|
-
gemfile: "activerecord_7.2"
|
|
36
|
-
|
|
37
|
-
- ruby: "2.7"
|
|
32
|
+
- ruby: "jruby-9.4"
|
|
38
33
|
gemfile: "activerecord_8.0"
|
|
39
|
-
|
|
40
|
-
- ruby: "2.8"
|
|
34
|
+
- ruby: "2.7"
|
|
41
35
|
gemfile: "activerecord_8.0"
|
|
42
|
-
|
|
43
36
|
- ruby: "3.0"
|
|
44
37
|
gemfile: "activerecord_8.0"
|
|
45
|
-
|
|
46
38
|
- ruby: "3.1"
|
|
47
39
|
gemfile: "activerecord_8.0"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
gemfile: "activerecord_8.0"
|
|
51
|
-
|
|
40
|
+
- ruby: "jruby-9.4"
|
|
41
|
+
gemfile: "activerecord_8.1"
|
|
52
42
|
- ruby: "2.7"
|
|
43
|
+
gemfile: "activerecord_8.1"
|
|
44
|
+
- ruby: "3.0"
|
|
45
|
+
gemfile: "activerecord_8.1"
|
|
46
|
+
- ruby: "3.1"
|
|
47
|
+
gemfile: "activerecord_8.1"
|
|
48
|
+
- ruby: "jruby-9.4"
|
|
53
49
|
gemfile: "activerecord_master"
|
|
54
|
-
|
|
55
|
-
- ruby: "2.8"
|
|
50
|
+
- ruby: "2.7"
|
|
56
51
|
gemfile: "activerecord_master"
|
|
57
|
-
|
|
58
52
|
- ruby: "3.0"
|
|
59
53
|
gemfile: "activerecord_master"
|
|
60
|
-
|
|
61
54
|
- ruby: "3.1"
|
|
62
55
|
gemfile: "activerecord_master"
|
|
63
56
|
|
|
64
|
-
- ruby: "jruby-9.3.1.0"
|
|
65
|
-
gemfile: "activerecord_master"
|
|
66
|
-
|
|
67
57
|
runs-on: ubuntu-latest
|
|
68
58
|
env:
|
|
69
59
|
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
|
data/Appraisals
CHANGED
|
@@ -22,6 +22,10 @@ appraise "activerecord-8.0" do
|
|
|
22
22
|
gem "activerecord", github: 'rails/rails', branch: "8-0-stable"
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
appraise "activerecord-8.1" do
|
|
26
|
+
gem "activerecord", github: 'rails/rails', branch: "8-1-stable"
|
|
27
|
+
end
|
|
28
|
+
|
|
25
29
|
appraise "activerecord-master" do
|
|
26
30
|
gem "activerecord", github: 'rails/rails', branch: :main
|
|
27
31
|
end
|
data/CHANGES.md
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
Unreleased
|
|
2
2
|
----------
|
|
3
3
|
|
|
4
|
-
1.
|
|
4
|
+
1.2.1 (2025-12-02)
|
|
5
|
+
|
|
6
|
+
- Add `exclusion_constraint` #142
|
|
7
|
+
- Add ActiveRecord 8.2 QueryIntent support #146
|
|
8
|
+
|
|
9
|
+
1.2.0 (2025-12-01)
|
|
10
|
+
|
|
11
|
+
- ActiveRecord 8.1 support #143
|
|
12
|
+
|
|
13
|
+
1.1.1 (2024-11-14)
|
|
5
14
|
|
|
6
15
|
- Fix syntax error on 2.7 and 3.0.
|
|
7
16
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
[<img src="https://badge.fury.io/rb/activerecord-nulldb-adapter.
|
|
2
|
-
Version" />](http://badge.fury.io/rb/activerecord-nulldb-adapter) [
|
|
3
|
-
src="https://codeclimate.com/github/nulldb/nulldb.png"
|
|
4
|
-
/>](https://codeclimate.com/github/nulldb/nulldb) [<img
|
|
5
|
-
src="https://github.com/nulldb/nulldb/workflows/build/badge.svg?branch=master"
|
|
6
|
-
alt="Build Status" />](https://github.com/nulldb/nulldb/actions)
|
|
1
|
+
[<img src="https://badge.fury.io/rb/activerecord-nulldb-adapter.svg" alt="Gem
|
|
2
|
+
Version" />](http://badge.fury.io/rb/activerecord-nulldb-adapter) [](https://github.com/nulldb/nulldb/actions/workflows/ruby.yml)
|
|
7
3
|
|
|
8
4
|
# The NullDB Connection Adapter Plugin
|
|
9
5
|
|
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
|
20
20
|
s.homepage = "https://github.com/nulldb/nulldb"
|
|
21
21
|
s.licenses = ["MIT"]
|
|
22
22
|
|
|
23
|
-
s.add_runtime_dependency 'activerecord', '>= 6.
|
|
23
|
+
s.add_runtime_dependency 'activerecord', '>= 6.1', '< 8.2'
|
|
24
24
|
s.add_development_dependency 'spec'
|
|
25
25
|
s.add_development_dependency 'rdoc'
|
|
26
26
|
s.add_development_dependency 'rspec'
|
|
@@ -98,7 +98,7 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter < ActiveRecord::Connection
|
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
# Rails 6.1+
|
|
101
|
-
if ActiveRecord
|
|
101
|
+
if ActiveRecord.version >= Gem::Version.new('6.1.a')
|
|
102
102
|
def remove_index(table_name, column_name = nil, **options )
|
|
103
103
|
index_name = index_name_for_remove(table_name, column_name, options)
|
|
104
104
|
index = @indexes[table_name].reject! { |index| index.name == index_name }
|
|
@@ -269,9 +269,23 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter < ActiveRecord::Connection
|
|
|
269
269
|
end
|
|
270
270
|
|
|
271
271
|
### Rails 8.0+ ###
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
# Rails 8.2+ uses QueryIntent object, earlier versions use individual arguments
|
|
273
|
+
# https://github.com/rails/rails/pull/55897
|
|
274
|
+
if defined?(ActiveRecord::ConnectionAdapters::QueryIntent)
|
|
275
|
+
def perform_query(raw_connection, intent)
|
|
276
|
+
self.execution_log << Statement.new(entry_point, intent.processed_sql)
|
|
277
|
+
ActiveRecord::Result.empty
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
def cast_result(raw_result)
|
|
281
|
+
# NullDB returns ActiveRecord::Result directly, no casting needed
|
|
282
|
+
raw_result
|
|
283
|
+
end
|
|
284
|
+
else
|
|
285
|
+
def perform_query(raw_connection, statement, binds, type_casted_binds, prepare:, notification_payload:, batch:)
|
|
286
|
+
self.execution_log << Statement.new(entry_point, statement)
|
|
287
|
+
NullObject.new
|
|
288
|
+
end
|
|
275
289
|
end
|
|
276
290
|
|
|
277
291
|
def affected_rows(raw_result)
|
|
@@ -358,13 +372,34 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter < ActiveRecord::Connection
|
|
|
358
372
|
end
|
|
359
373
|
end
|
|
360
374
|
|
|
375
|
+
def native_database_types
|
|
376
|
+
{}
|
|
377
|
+
end
|
|
378
|
+
|
|
361
379
|
def default_column_arguments(col_def)
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
380
|
+
# ActiveRecord 8.1+ expects: name, cast_type, default, sql_type_metadata, null
|
|
381
|
+
# Earlier versions expect: name, default, sql_type_metadata, null
|
|
382
|
+
if ::ActiveRecord.version >= Gem::Version.new('8.1.a')
|
|
383
|
+
cast_type = ActiveRecord::ConnectionAdapters::AbstractAdapter::TYPE_MAP.lookup(col_def.type.to_s)
|
|
384
|
+
sql_type_meta = sql_type_definition(col_def)
|
|
385
|
+
|
|
386
|
+
[
|
|
387
|
+
col_def.name.to_s,
|
|
388
|
+
cast_type,
|
|
389
|
+
col_def.default.present? ? col_def.default.to_s : nil,
|
|
390
|
+
sql_type_meta,
|
|
391
|
+
col_def.null.nil? || col_def.null
|
|
392
|
+
]
|
|
393
|
+
else
|
|
394
|
+
sql_type_meta = sql_type_definition(col_def)
|
|
395
|
+
|
|
396
|
+
[
|
|
397
|
+
col_def.name.to_s,
|
|
398
|
+
col_def.default.present? ? col_def.default.to_s : nil,
|
|
399
|
+
sql_type_meta,
|
|
400
|
+
col_def.null.nil? || col_def.null
|
|
401
|
+
]
|
|
402
|
+
end
|
|
368
403
|
end
|
|
369
404
|
|
|
370
405
|
def sql_type_definition(col_def)
|
|
@@ -14,8 +14,9 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter
|
|
|
14
14
|
alias_method :hstore, :json
|
|
15
15
|
|
|
16
16
|
def unique_constraint(*args, **kwargs, &block); end
|
|
17
|
+
def exclusion_constraint(*args); end
|
|
17
18
|
|
|
18
|
-
if ::ActiveRecord
|
|
19
|
+
if ::ActiveRecord.version >= Gem::Version.new('7.1.a')
|
|
19
20
|
# Avoid check for option validity
|
|
20
21
|
def create_column_definition(name, type, options)
|
|
21
22
|
ActiveRecord::ConnectionAdapters::ColumnDefinition.new(name, type, options)
|
data/lib/nulldb/version.rb
CHANGED
data/spec/nulldb_spec.rb
CHANGED
|
@@ -124,8 +124,17 @@ describe "NullDB" do
|
|
|
124
124
|
expect(Employee.columns_hash['name'].null).to be false
|
|
125
125
|
end
|
|
126
126
|
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
# In ActiveRecord 8.1+, immutable default values are type-casted by the Column class
|
|
128
|
+
# For boolean columns for example, "true" is deserialized to true
|
|
129
|
+
# https://github.com/rails/rails/commit/205cdd5
|
|
130
|
+
if ::ActiveRecord.version >= Gem::Version.new('8.1.a')
|
|
131
|
+
it "should deserialize immutable default values" do
|
|
132
|
+
expect(Employee.columns_hash['active'].default).to eq true
|
|
133
|
+
end
|
|
134
|
+
else
|
|
135
|
+
it "should stringify default values" do
|
|
136
|
+
expect(Employee.columns_hash['active'].default).to eq "true"
|
|
137
|
+
end
|
|
129
138
|
end
|
|
130
139
|
|
|
131
140
|
it "should have no default for employee_number" do
|
|
@@ -194,9 +203,9 @@ describe "NullDB" do
|
|
|
194
203
|
expect( Employee.connection.tables ).to include "schema_info"
|
|
195
204
|
end
|
|
196
205
|
|
|
197
|
-
it "should return an empty
|
|
206
|
+
it "should return an empty result from #select" do
|
|
198
207
|
result = Employee.connection.select_all("who cares", "blah")
|
|
199
|
-
expect( result ).to eq []
|
|
208
|
+
expect( result.to_a ).to eq []
|
|
200
209
|
end
|
|
201
210
|
|
|
202
211
|
it "should provide a way to set log checkpoints" do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activerecord-nulldb-adapter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Avdi Grimm
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2025-12-03 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: activerecord
|
|
@@ -18,20 +18,20 @@ dependencies:
|
|
|
18
18
|
requirements:
|
|
19
19
|
- - ">="
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: '6.
|
|
21
|
+
version: '6.1'
|
|
22
22
|
- - "<"
|
|
23
23
|
- !ruby/object:Gem::Version
|
|
24
|
-
version: '8.
|
|
24
|
+
version: '8.2'
|
|
25
25
|
type: :runtime
|
|
26
26
|
prerelease: false
|
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
|
28
28
|
requirements:
|
|
29
29
|
- - ">="
|
|
30
30
|
- !ruby/object:Gem::Version
|
|
31
|
-
version: '6.
|
|
31
|
+
version: '6.1'
|
|
32
32
|
- - "<"
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: '8.
|
|
34
|
+
version: '8.2'
|
|
35
35
|
- !ruby/object:Gem::Dependency
|
|
36
36
|
name: spec
|
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -149,12 +149,12 @@ files:
|
|
|
149
149
|
- README.md
|
|
150
150
|
- Rakefile
|
|
151
151
|
- activerecord-nulldb-adapter.gemspec
|
|
152
|
-
- gemfiles/activerecord_6.0.gemfile
|
|
153
152
|
- gemfiles/activerecord_6.1.gemfile
|
|
154
153
|
- gemfiles/activerecord_7.0.gemfile
|
|
155
154
|
- gemfiles/activerecord_7.1.gemfile
|
|
156
155
|
- gemfiles/activerecord_7.2.gemfile
|
|
157
156
|
- gemfiles/activerecord_8.0.gemfile
|
|
157
|
+
- gemfiles/activerecord_8.1.gemfile
|
|
158
158
|
- gemfiles/activerecord_master.gemfile
|
|
159
159
|
- lib/active_record/connection_adapters/nulldb_adapter.rb
|
|
160
160
|
- lib/active_record/connection_adapters/nulldb_adapter/checkpoint.rb
|
|
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
198
198
|
- !ruby/object:Gem::Version
|
|
199
199
|
version: '0'
|
|
200
200
|
requirements: []
|
|
201
|
-
rubygems_version: 3.
|
|
201
|
+
rubygems_version: 3.1.6
|
|
202
202
|
signing_key:
|
|
203
203
|
specification_version: 4
|
|
204
204
|
summary: The Null Object pattern as applied to ActiveRecord database adapters
|