activegraph 12.0.0.beta.7 → 12.0.0
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/CHANGELOG.md +11 -6
- data/activegraph.gemspec +1 -1
- data/lib/active_graph/core/result.rb +4 -4
- data/lib/active_graph/core/schema.rb +5 -1
- data/lib/active_graph/migrations/helpers/relationships.rb +1 -1
- data/lib/active_graph/shared/property.rb +1 -1
- data/lib/active_graph/shared/type_converters.rb +42 -0
- data/lib/active_graph/transaction.rb +2 -2
- data/lib/active_graph/version.rb +1 -1
- data/lib/active_graph.rb +2 -0
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 631a772ff4cad538ff9390a07f910d0369c341e0bc6e8e35957521a1ec16cba4
|
|
4
|
+
data.tar.gz: 45daf82de8e8bce83260c8245f8988e897dcd70dc35fda742247525e1e7ab38b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a571949dd06e7289914e90ba4d8507793b73b48531a7d8d17a83a15c145e901e73380783ba3521da52a6bcc93056ec290969b007d3a455588699c720e8103774
|
|
7
|
+
data.tar.gz: d501ed3dfed4a833b93608de5f883721a93277752719abda0d1c9ba734fc1c62acebba0fd88a037cb1f446432bee00992d83a66904ce3a741c7941442a159532
|
data/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file.
|
|
|
3
3
|
This file should follow the standards specified on [http://keepachangelog.com/]
|
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
|
|
6
|
+
## [12.0.0] (2026-08-16)
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
- Use the driver-native Neo4j::Driver::Types::Duration instead of ActiveSupport::Duration
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Type converted for ActiveSupport::Duration to Neo4j::Driver::Types::Duration for backward compatibility. The converter is lossy if fractional units are used in ActiveSupport::Duration.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- Adapt to neo4j-ruby-driver 6.2.1
|
|
16
|
+
|
|
6
17
|
## [12.0.0.beta.7] (2026-03-19)
|
|
7
18
|
|
|
8
19
|
### Fixed
|
|
@@ -243,12 +254,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
243
254
|
|
|
244
255
|
- Micro-optimizations which help when dealing with a lot of data (thanks @jgaskins / see #1490)
|
|
245
256
|
|
|
246
|
-
## [9.1.8] 2018-03-27
|
|
247
|
-
|
|
248
|
-
## Fixed
|
|
249
|
-
|
|
250
|
-
- Micro-optimizations which help when dealing with a lot of data (thanks @jgaskins / see #1490)
|
|
251
|
-
|
|
252
257
|
## [9.1.7] 2018-03-27
|
|
253
258
|
|
|
254
259
|
## Fixed
|
data/activegraph.gemspec
CHANGED
|
@@ -33,7 +33,7 @@ DESCRIPTION
|
|
|
33
33
|
s.add_dependency('activemodel')
|
|
34
34
|
s.add_dependency('benchmark')
|
|
35
35
|
s.add_dependency('i18n', '!= 1.8.8') # https://github.com/jruby/jruby/issues/6547
|
|
36
|
-
s.add_dependency('neo4j-ruby-driver', '
|
|
36
|
+
s.add_dependency('neo4j-ruby-driver', '~> 6.2.1.beta.4')
|
|
37
37
|
s.add_dependency('orm_adapter', '>= 0.5.0')
|
|
38
38
|
s.add_development_dependency('guard')
|
|
39
39
|
s.add_development_dependency('guard-rspec')
|
|
@@ -13,7 +13,7 @@ module ActiveGraph
|
|
|
13
13
|
|
|
14
14
|
def each(&block)
|
|
15
15
|
store if wrap? # TODO: why? This is preventing streaming
|
|
16
|
-
@
|
|
16
|
+
@wrapped_records&.each(&block) || super
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
## To avoid to_a on Neo4j::Driver::Result as that one does not call the above block
|
|
@@ -22,13 +22,13 @@ module ActiveGraph
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def store
|
|
25
|
-
return if @
|
|
25
|
+
return if @wrapped_records
|
|
26
26
|
keys
|
|
27
|
-
@
|
|
27
|
+
@wrapped_records = []
|
|
28
28
|
# TODO: implement 'each' without block parameter
|
|
29
29
|
method(:each).super_method.call do |record|
|
|
30
30
|
record.wrap = wrap?
|
|
31
|
-
@
|
|
31
|
+
@wrapped_records << record
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
|
@@ -59,8 +59,12 @@ module ActiveGraph
|
|
|
59
59
|
@major ||= version.segments.first
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
+
# Neo4j 2026.07+ renamed the uniqueness constraint types
|
|
63
|
+
# (UNIQUENESS -> NODE_PROPERTY_UNIQUENESS, RELATIONSHIP_UNIQUENESS ->
|
|
64
|
+
# RELATIONSHIP_PROPERTY_UNIQUENESS); accept both the old and new names.
|
|
62
65
|
def constraint_filter(record)
|
|
63
|
-
%w[UNIQUENESS RELATIONSHIP_UNIQUENESS
|
|
66
|
+
%w[UNIQUENESS NODE_PROPERTY_UNIQUENESS RELATIONSHIP_UNIQUENESS RELATIONSHIP_PROPERTY_UNIQUENESS
|
|
67
|
+
RELATIONSHIP_PROPERTY_EXISTENCE NODE_PROPERTY_EXISTENCE NODE_KEY RELATIONSHIP_KEY].include?(record[:type])
|
|
64
68
|
end
|
|
65
69
|
|
|
66
70
|
def index_cypher(label, properties)
|
|
@@ -20,7 +20,7 @@ module ActiveGraph
|
|
|
20
20
|
count = count_relations(relation_query)
|
|
21
21
|
output "Indexing #{count} #{old_name}s into #{new_name}..."
|
|
22
22
|
while count > 0
|
|
23
|
-
relation_query.create("(a)-[r2:`#{new_name}`]->(b)").set('r2 = r').with(:r).limit(max_per_batch).delete(:r).exec
|
|
23
|
+
relation_query.create("(a)-[r2:`#{new_name}`]->(b)").set('r2 = properties(r)').with(:r).limit(max_per_batch).delete(:r).exec
|
|
24
24
|
count = count_relations(relation_query)
|
|
25
25
|
output "... #{count} #{old_name}'s left to go.." if count > 0
|
|
26
26
|
end
|
|
@@ -12,7 +12,7 @@ module ActiveGraph::Shared
|
|
|
12
12
|
attr_reader :_persisted_obj
|
|
13
13
|
|
|
14
14
|
# This list should not be statically created. All types which have converters should by type casted
|
|
15
|
-
NEO4J_DRIVER_DATA_TYPES = [Hash,
|
|
15
|
+
NEO4J_DRIVER_DATA_TYPES = [Hash, Neo4j::Driver::Types::Duration, Neo4j::Driver::Types::Point,
|
|
16
16
|
Neo4j::Driver::Types::OffsetTime, Neo4j::Driver::Types::LocalTime, Neo4j::Driver::Types::LocalDateTime]
|
|
17
17
|
|
|
18
18
|
# TODO: Set @attribute correctly using class ActiveModel::Attribute, and after that
|
|
@@ -185,6 +185,48 @@ module ActiveGraph::Shared
|
|
|
185
185
|
end
|
|
186
186
|
end
|
|
187
187
|
|
|
188
|
+
# Converts ActiveSupport::Duration to/from the driver-native
|
|
189
|
+
# Neo4j::Driver::Types::Duration. Kept for backwards compatibility: since
|
|
190
|
+
# driver 6.2.1 a Neo4j duration is a Types::Duration, but models may still
|
|
191
|
+
# declare `type: ActiveSupport::Duration`. The mapping is field-to-field
|
|
192
|
+
# (parts <-> months/days/seconds/nanoseconds) and value-exact; the only soft
|
|
193
|
+
# spot is a fractional calendar month, which has no exact finer form and
|
|
194
|
+
# degrades to seconds via ActiveSupport's own rate.
|
|
195
|
+
class DurationConverter < BaseConverter
|
|
196
|
+
class << self
|
|
197
|
+
def convert_type
|
|
198
|
+
ActiveSupport::Duration
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
def db_type
|
|
202
|
+
Neo4j::Driver::Types::Duration
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def to_db(value)
|
|
206
|
+
parts = Hash.new(0).merge(value.parts)
|
|
207
|
+
months_f = parts[:years] * 12 + parts[:months]
|
|
208
|
+
days_f = parts[:weeks] * 7 + parts[:days]
|
|
209
|
+
months = months_f.to_i
|
|
210
|
+
days = days_f.to_i
|
|
211
|
+
# whole calendar units stay put; fractional months/days cascade into
|
|
212
|
+
# seconds rather than truncating (which would lose magnitude)
|
|
213
|
+
seconds = parts[:hours] * 3600 + parts[:minutes] * 60 + parts[:seconds] +
|
|
214
|
+
(months_f - months) * ActiveSupport::Duration::SECONDS_PER_MONTH +
|
|
215
|
+
(days_f - days) * ActiveSupport::Duration::SECONDS_PER_DAY
|
|
216
|
+
Neo4j::Driver::Types::Duration.new(months, days, seconds.floor, ((seconds % 1) * 1_000_000_000).round)
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
def to_ruby(value)
|
|
220
|
+
return value if value.is_a?(ActiveSupport::Duration)
|
|
221
|
+
# map each Neo4j field back to its ActiveSupport unit, field-to-field,
|
|
222
|
+
# so the calendar structure survives the round trip
|
|
223
|
+
ActiveSupport::Duration.months(value.months) +
|
|
224
|
+
ActiveSupport::Duration.days(value.days) +
|
|
225
|
+
ActiveSupport::Duration.seconds(value.seconds + Rational(value.nanoseconds, 1_000_000_000))
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
|
|
188
230
|
class BooleanConverter < BaseConverter
|
|
189
231
|
FALSE_VALUES = %w(n N no No NO false False FALSE off Off OFF f F).to_set
|
|
190
232
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module ActiveGraph
|
|
2
2
|
module Transaction
|
|
3
3
|
def rollback
|
|
4
|
-
@
|
|
4
|
+
@active_graph_rolled_back = true
|
|
5
5
|
end
|
|
6
6
|
|
|
7
7
|
def check_rollback
|
|
8
|
-
fail ActiveGraph::Rollback if @
|
|
8
|
+
fail ActiveGraph::Rollback if @active_graph_rolled_back
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def after_commit(&block)
|
data/lib/active_graph/version.rb
CHANGED
data/lib/active_graph.rb
CHANGED
|
@@ -10,6 +10,8 @@ require 'active_support/core_ext/class/attribute'
|
|
|
10
10
|
require 'active_support/core_ext/class/subclasses'
|
|
11
11
|
require 'active_support/core_ext/module/attribute_accessors'
|
|
12
12
|
require 'active_support/core_ext/module/attribute_accessors_per_thread'
|
|
13
|
+
require 'active_support/core_ext/numeric/time'
|
|
14
|
+
require 'active_support/core_ext/integer/time'
|
|
13
15
|
require 'active_support/core_ext/string/conversions'
|
|
14
16
|
require 'active_support/inflector'
|
|
15
17
|
require 'active_support/inflector/inflections'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activegraph
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 12.0.0
|
|
4
|
+
version: 12.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andreas Ronge, Brian Underwood, Chris Grigg, Heinrich Klobuczek
|
|
@@ -55,16 +55,16 @@ dependencies:
|
|
|
55
55
|
name: neo4j-ruby-driver
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
|
-
- - "
|
|
58
|
+
- - "~>"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 6.
|
|
60
|
+
version: 6.2.1.beta.4
|
|
61
61
|
type: :runtime
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
|
-
- - "
|
|
65
|
+
- - "~>"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: 6.
|
|
67
|
+
version: 6.2.1.beta.4
|
|
68
68
|
- !ruby/object:Gem::Dependency
|
|
69
69
|
name: orm_adapter
|
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -431,7 +431,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
431
431
|
- !ruby/object:Gem::Version
|
|
432
432
|
version: '0'
|
|
433
433
|
requirements: []
|
|
434
|
-
rubygems_version: 4.0.
|
|
434
|
+
rubygems_version: 4.0.16
|
|
435
435
|
specification_version: 4
|
|
436
436
|
summary: A graph database for Ruby
|
|
437
437
|
test_files: []
|