activerecord-nulldb-adapter 1.2.0 → 1.2.2
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 +3 -29
- data/CHANGES.md +9 -0
- data/lib/active_record/connection_adapters/nulldb_adapter/core.rb +23 -5
- data/lib/active_record/connection_adapters/nulldb_adapter/table_definition.rb +4 -1
- data/lib/nulldb/version.rb +1 -1
- data/spec/nulldb_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 362c222232d5331728d98e021e3c50edfa6c894dbd426c961e1ab2dcc4c446f9
|
|
4
|
+
data.tar.gz: a76583e24059ad2afc217763f88de1ee045927e5cece249248aa6dcfc4a52909
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0730a4c5844c907419096363525915ff2dc329a6f26c7d8af0a47d970fee34e090b5f75a079dc4029f4c36da8192e5ea49dff709b0cbd90a9db62c51d67be1f7
|
|
7
|
+
data.tar.gz: c82b23c72c7c361ae3eb8f375033f6bcc07350f684d2414cc2d1925d75079c3d2babd76ef2e7522903aafcf72d3f52ab1c201ec4497ea69c75bd134c85d427de
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -8,52 +8,26 @@ jobs:
|
|
|
8
8
|
gemfile:
|
|
9
9
|
[
|
|
10
10
|
activerecord_6.1,
|
|
11
|
-
activerecord_7.0,
|
|
12
|
-
activerecord_7.1,
|
|
13
11
|
activerecord_7.2,
|
|
14
|
-
activerecord_8.0,
|
|
15
12
|
activerecord_8.1,
|
|
16
13
|
activerecord_master,
|
|
17
14
|
]
|
|
18
|
-
ruby: ["
|
|
15
|
+
ruby: ["3.3", "3.4", "jruby-9.4", "jruby-10"]
|
|
19
16
|
exclude:
|
|
20
17
|
- ruby: "3.4"
|
|
21
18
|
gemfile: "activerecord_6.1"
|
|
22
19
|
- ruby: "3.4"
|
|
23
20
|
gemfile: "activerecord_7.0"
|
|
24
|
-
- ruby: "jruby-9.4"
|
|
25
|
-
gemfile: "activerecord_7.1"
|
|
26
21
|
- ruby: "3.4"
|
|
27
22
|
gemfile: "activerecord_7.1"
|
|
28
|
-
- ruby: "2.7"
|
|
29
|
-
gemfile: "activerecord_7.2"
|
|
30
|
-
- ruby: "3.0"
|
|
31
|
-
gemfile: "activerecord_7.2"
|
|
32
23
|
- ruby: "jruby-9.4"
|
|
33
|
-
gemfile: "
|
|
34
|
-
- ruby: "
|
|
35
|
-
gemfile: "activerecord_8.0"
|
|
36
|
-
- ruby: "3.0"
|
|
37
|
-
gemfile: "activerecord_8.0"
|
|
38
|
-
- ruby: "3.1"
|
|
24
|
+
gemfile: "activerecord_7.1"
|
|
25
|
+
- ruby: "jruby-9.4"
|
|
39
26
|
gemfile: "activerecord_8.0"
|
|
40
27
|
- ruby: "jruby-9.4"
|
|
41
28
|
gemfile: "activerecord_8.1"
|
|
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
29
|
- ruby: "jruby-9.4"
|
|
49
30
|
gemfile: "activerecord_master"
|
|
50
|
-
- ruby: "2.7"
|
|
51
|
-
gemfile: "activerecord_master"
|
|
52
|
-
- ruby: "3.0"
|
|
53
|
-
gemfile: "activerecord_master"
|
|
54
|
-
- ruby: "3.1"
|
|
55
|
-
gemfile: "activerecord_master"
|
|
56
|
-
|
|
57
31
|
runs-on: ubuntu-latest
|
|
58
32
|
env:
|
|
59
33
|
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
|
data/CHANGES.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
Unreleased
|
|
2
2
|
----------
|
|
3
3
|
|
|
4
|
+
1.2.2 (2025-12-02)
|
|
5
|
+
|
|
6
|
+
- Add `timestamptz`, `tstzrange`, `create_schema` #144
|
|
7
|
+
|
|
8
|
+
1.2.1 (2025-12-02)
|
|
9
|
+
|
|
10
|
+
- Add `exclusion_constraint` #142
|
|
11
|
+
- Add ActiveRecord 8.2 QueryIntent support #146
|
|
12
|
+
|
|
4
13
|
1.2.0 (2025-12-01)
|
|
5
14
|
|
|
6
15
|
- ActiveRecord 8.1 support #143
|
|
@@ -64,6 +64,10 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter < ActiveRecord::Connection
|
|
|
64
64
|
true
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
+
def create_schema(*args)
|
|
68
|
+
# NOOP
|
|
69
|
+
end
|
|
70
|
+
|
|
67
71
|
def create_table(table_name, options = {})
|
|
68
72
|
table_definition = new_table_definition(self, table_name, options.delete(:temporary), options)
|
|
69
73
|
|
|
@@ -98,7 +102,7 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter < ActiveRecord::Connection
|
|
|
98
102
|
end
|
|
99
103
|
|
|
100
104
|
# Rails 6.1+
|
|
101
|
-
if ActiveRecord
|
|
105
|
+
if ActiveRecord.version >= Gem::Version.new('6.1.a')
|
|
102
106
|
def remove_index(table_name, column_name = nil, **options )
|
|
103
107
|
index_name = index_name_for_remove(table_name, column_name, options)
|
|
104
108
|
index = @indexes[table_name].reject! { |index| index.name == index_name }
|
|
@@ -269,9 +273,23 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter < ActiveRecord::Connection
|
|
|
269
273
|
end
|
|
270
274
|
|
|
271
275
|
### Rails 8.0+ ###
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
276
|
+
# Rails 8.2+ uses QueryIntent object, earlier versions use individual arguments
|
|
277
|
+
# https://github.com/rails/rails/pull/55897
|
|
278
|
+
if defined?(ActiveRecord::ConnectionAdapters::QueryIntent)
|
|
279
|
+
def perform_query(raw_connection, intent)
|
|
280
|
+
self.execution_log << Statement.new(entry_point, intent.processed_sql)
|
|
281
|
+
ActiveRecord::Result.empty
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def cast_result(raw_result)
|
|
285
|
+
# NullDB returns ActiveRecord::Result directly, no casting needed
|
|
286
|
+
raw_result
|
|
287
|
+
end
|
|
288
|
+
else
|
|
289
|
+
def perform_query(raw_connection, statement, binds, type_casted_binds, prepare:, notification_payload:, batch:)
|
|
290
|
+
self.execution_log << Statement.new(entry_point, statement)
|
|
291
|
+
NullObject.new
|
|
292
|
+
end
|
|
275
293
|
end
|
|
276
294
|
|
|
277
295
|
def affected_rows(raw_result)
|
|
@@ -365,7 +383,7 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter < ActiveRecord::Connection
|
|
|
365
383
|
def default_column_arguments(col_def)
|
|
366
384
|
# ActiveRecord 8.1+ expects: name, cast_type, default, sql_type_metadata, null
|
|
367
385
|
# Earlier versions expect: name, default, sql_type_metadata, null
|
|
368
|
-
if ::ActiveRecord
|
|
386
|
+
if ::ActiveRecord.version >= Gem::Version.new('8.1.a')
|
|
369
387
|
cast_type = ActiveRecord::ConnectionAdapters::AbstractAdapter::TYPE_MAP.lookup(col_def.type.to_s)
|
|
370
388
|
sql_type_meta = sql_type_definition(col_def)
|
|
371
389
|
|
|
@@ -10,12 +10,15 @@ class ActiveRecord::ConnectionAdapters::NullDBAdapter
|
|
|
10
10
|
alias_method :serial, :integer
|
|
11
11
|
alias_method :bigserial, :integer
|
|
12
12
|
alias_method :inet, :string
|
|
13
|
+
alias_method :timestamptz, :string
|
|
14
|
+
alias_method :tstzrange, :string
|
|
13
15
|
alias_method :jsonb, :json if method_defined? :json
|
|
14
16
|
alias_method :hstore, :json
|
|
15
17
|
|
|
16
18
|
def unique_constraint(*args, **kwargs, &block); end
|
|
19
|
+
def exclusion_constraint(*args); end
|
|
17
20
|
|
|
18
|
-
if ::ActiveRecord
|
|
21
|
+
if ::ActiveRecord.version >= Gem::Version.new('7.1.a')
|
|
19
22
|
# Avoid check for option validity
|
|
20
23
|
def create_column_definition(name, type, options)
|
|
21
24
|
ActiveRecord::ConnectionAdapters::ColumnDefinition.new(name, type, options)
|
data/lib/nulldb/version.rb
CHANGED
data/spec/nulldb_spec.rb
CHANGED
|
@@ -127,7 +127,7 @@ describe "NullDB" do
|
|
|
127
127
|
# In ActiveRecord 8.1+, immutable default values are type-casted by the Column class
|
|
128
128
|
# For boolean columns for example, "true" is deserialized to true
|
|
129
129
|
# https://github.com/rails/rails/commit/205cdd5
|
|
130
|
-
if ActiveRecord
|
|
130
|
+
if ::ActiveRecord.version >= Gem::Version.new('8.1.a')
|
|
131
131
|
it "should deserialize immutable default values" do
|
|
132
132
|
expect(Employee.columns_hash['active'].default).to eq true
|
|
133
133
|
end
|
|
@@ -203,9 +203,9 @@ describe "NullDB" do
|
|
|
203
203
|
expect( Employee.connection.tables ).to include "schema_info"
|
|
204
204
|
end
|
|
205
205
|
|
|
206
|
-
it "should return an empty
|
|
206
|
+
it "should return an empty result from #select" do
|
|
207
207
|
result = Employee.connection.select_all("who cares", "blah")
|
|
208
|
-
expect( result ).to eq []
|
|
208
|
+
expect( result.to_a ).to eq []
|
|
209
209
|
end
|
|
210
210
|
|
|
211
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.2.
|
|
4
|
+
version: 1.2.2
|
|
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: 2025-12-
|
|
13
|
+
date: 2025-12-03 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: activerecord
|