activegraph 10.0.2 → 10.2.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/Gemfile +1 -2
- data/README.md +22 -20
- data/activegraph.gemspec +4 -2
- data/lib/active_graph/core/schema.rb +22 -18
- data/lib/active_graph/migrations/base.rb +7 -3
- data/lib/active_graph/migrations/runner.rb +13 -9
- data/lib/active_graph/node/has_n.rb +4 -2
- data/lib/active_graph/node/query/query_proxy_eager_loading/association_tree.rb +1 -0
- data/lib/active_graph/node/query/query_proxy_eager_loading.rb +3 -9
- data/lib/active_graph/node/validations.rb +1 -1
- data/lib/active_graph/version.rb +1 -1
- metadata +37 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c01920a2ca46982b8de50984fbd0a07210ef483a4b933f0de9f4b9c3caa9bb1e
|
4
|
+
data.tar.gz: 1a3c0f858a7653a1a30497b5df0ef552a297efb66d6f5ff56ec545a81b666be1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e63aa9728efe64bb40bd0b650d6485af7ee9e814b951ee30d6862ef2821556891d8d95cb9d637711a35f18e5d98347b8913c1d42f51c93d4ee694fee873f440e
|
7
|
+
data.tar.gz: 1632af7ded55530fa57b22754a0a156aa3662f61c8cbd962e87753971bf11bf6fdf345d897b80b7537bb61705c5cf5e69f50afc41b48b5c7c64ff4ebe3590f9a
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,19 @@ 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
|
+
## [10.1.1] 2021-11-05
|
7
|
+
|
8
|
+
## Fixed
|
9
|
+
|
10
|
+
- Fixed issue where some has_one relationships where incorrectly deleted disregarding direction
|
11
|
+
- It changes the relationship length assignment in query proxy eagerloading module to be consistent with query proxy relationship length syntax.
|
12
|
+
|
13
|
+
## [10.1.0] 2021-02-05
|
14
|
+
|
15
|
+
## Added
|
16
|
+
|
17
|
+
- support for ruby 3.0.0
|
18
|
+
|
6
19
|
## [10.0.2] 2020-12-08
|
7
20
|
|
8
21
|
## Fixed
|
data/Gemfile
CHANGED
@@ -7,7 +7,7 @@ gemspec
|
|
7
7
|
gem 'listen', '< 3.1'
|
8
8
|
|
9
9
|
active_model_version = ENV['ACTIVE_MODEL_VERSION']
|
10
|
-
gem 'activemodel', "~> #{active_model_version}" if active_model_version
|
10
|
+
gem 'activemodel', "~> #{active_model_version}" if active_model_version&.length&.positive?
|
11
11
|
|
12
12
|
group 'test' do
|
13
13
|
gem 'coveralls', require: false
|
@@ -15,7 +15,6 @@ group 'test' do
|
|
15
15
|
gem 'codecov', require: false
|
16
16
|
gem 'simplecov', require: false
|
17
17
|
gem 'simplecov-html', require: false
|
18
|
-
gem 'rspec', '~> 3.4'
|
19
18
|
gem 'its'
|
20
19
|
gem 'test-unit'
|
21
20
|
gem 'colored'
|
data/README.md
CHANGED
@@ -45,31 +45,33 @@ Neo4j.rb v4.1.0 was released in January of 2015. Its changes are outlined [here]
|
|
45
45
|
|
46
46
|
## Neo4j version support
|
47
47
|
|
48
|
-
| **Neo4j Version** | v2.x | v3.x | >= v4.x | >= 7.0.3 | activegraph 10.0 |
|
49
|
-
|
50
|
-
| 1.9.x | Yes | No | No | No | No |
|
51
|
-
| 2.0.x | No | Yes | No | No | No |
|
52
|
-
| 2.1.x | No | Yes | Yes * | Yes | No |
|
53
|
-
| 2.2.x | No | No | Yes | Yes | No |
|
54
|
-
| 2.3.x | No | No | Yes | Yes | No |
|
55
|
-
| 3.0, 3.1, 3.3 | No | No | No | Yes | No |
|
56
|
-
| 3.4
|
57
|
-
|
|
58
|
-
| 4.
|
48
|
+
| **Neo4j Version** | v2.x | v3.x | >= v4.x | >= 7.0.3 | activegraph 10.0 | activegraph 11.0.0.beta.4-java |
|
49
|
+
|-------------------|------|-------|---------|----------|------------------|--------------------------------|
|
50
|
+
| 1.9.x | Yes | No | No | No | No | No
|
51
|
+
| 2.0.x | No | Yes | No | No | No | No
|
52
|
+
| 2.1.x | No | Yes | Yes * | Yes | No | No
|
53
|
+
| 2.2.x | No | No | Yes | Yes | No | No
|
54
|
+
| 2.3.x | No | No | Yes | Yes | No | No
|
55
|
+
| 3.0, 3.1, 3.3 | No | No | No | Yes | No | No
|
56
|
+
| 3.4 | No | No | No | Yes | Yes | No
|
57
|
+
| 3.5 | No | No | No | Yes | Yes | Yes
|
58
|
+
| 4.0 | No | No | No | No | Yes | Yes
|
59
|
+
| 4.1 | No | No | No | No | No | Yes
|
60
|
+
| 4.2 | No | No | No | No | No | Yes
|
59
61
|
|
60
62
|
`*` Neo4j.rb >= 4.x doesn't support Neo4j versions before 2.1.5. To use 2.1.x you should upgrade to a version >= 2.1.5
|
61
63
|
|
62
64
|
## Neo4j feature support
|
63
65
|
|
64
|
-
| **Neo4j Feature** | v2.x | v3.x | >= v4.x | >= 8.x | activegraph 10.0 |
|
65
|
-
|
66
|
-
| Bolt Protocol | No | No | No | Yes | Yes
|
67
|
-
| Auth | No | No | Yes | Yes | Yes
|
68
|
-
| Remote Cypher | Yes | Yes | Yes | Yes | No
|
69
|
-
| Transactions | Yes | Yes | Yes | Yes | Yes
|
70
|
-
| High Availability | No | Yes | Yes | Yes | Yes
|
71
|
-
| Causal Cluster | No | No | No | No | Yes
|
72
|
-
| Embedded JVM support | Yes | Yes | Yes | Yes | via bolt only
|
66
|
+
| **Neo4j Feature** | v2.x | v3.x | >= v4.x | >= 8.x | >= activegraph 10.0 |
|
67
|
+
|----------------------------|--------|------|---------|--------|---------------------|
|
68
|
+
| Bolt Protocol | No | No | No | Yes | Yes |
|
69
|
+
| Auth | No | No | Yes | Yes | Yes |
|
70
|
+
| Remote Cypher | Yes | Yes | Yes | Yes | No |
|
71
|
+
| Transactions | Yes | Yes | Yes | Yes | Yes |
|
72
|
+
| High Availability | No | Yes | Yes | Yes | Yes |
|
73
|
+
| Causal Cluster | No | No | No | No | Yes |
|
74
|
+
| Embedded JVM support | Yes | Yes | Yes | Yes | via bolt only |
|
73
75
|
|
74
76
|
## Documentation
|
75
77
|
|
data/activegraph.gemspec
CHANGED
@@ -32,13 +32,14 @@ DESCRIPTION
|
|
32
32
|
|
33
33
|
s.add_dependency('activemodel', '>= 4.0')
|
34
34
|
s.add_dependency('activesupport', '>= 4.0')
|
35
|
-
s.add_dependency('i18n', '!= 1.
|
35
|
+
s.add_dependency('i18n', '!= 1.8.8') # https://github.com/jruby/jruby/issues/6547
|
36
36
|
s.add_dependency('orm_adapter', '~> 0.5.0')
|
37
|
+
s.add_dependency('sorted_set')
|
37
38
|
s.add_development_dependency('guard')
|
38
39
|
s.add_development_dependency('guard-rspec')
|
39
40
|
s.add_development_dependency('guard-rubocop')
|
40
41
|
s.add_development_dependency('neo4j-rake_tasks', '>= 0.3.0')
|
41
|
-
s.add_development_dependency("neo4j-#{ENV['driver'] == 'java' ? 'java' : 'ruby'}-driver", '~> 1.7.
|
42
|
+
s.add_development_dependency("neo4j-#{ENV['driver'] == 'java' ? 'java' : 'ruby'}-driver", '~> 1.7.4')
|
42
43
|
s.add_development_dependency('os')
|
43
44
|
s.add_development_dependency('pry')
|
44
45
|
s.add_development_dependency('railties', '>= 4.0')
|
@@ -46,4 +47,5 @@ DESCRIPTION
|
|
46
47
|
s.add_development_dependency('rubocop', '>= 0.56.0')
|
47
48
|
s.add_development_dependency('yard')
|
48
49
|
s.add_development_dependency('dryspec')
|
50
|
+
s.add_development_dependency('rspec', '< 3.10') # Cannot proxy frozen objects
|
49
51
|
end
|
@@ -2,28 +2,32 @@ module ActiveGraph
|
|
2
2
|
module Core
|
3
3
|
module Schema
|
4
4
|
def version
|
5
|
-
result = query('CALL dbms.components()', {}, skip_instrumentation: true)
|
6
|
-
|
7
5
|
# BTW: community / enterprise could be retrieved via `result.first.edition`
|
8
|
-
|
6
|
+
query('CALL dbms.components()', {}, skip_instrumentation: true).first[:versions][0]
|
9
7
|
end
|
10
8
|
|
11
9
|
def indexes
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
raw_indexes do |keys, result|
|
11
|
+
result.map do |row|
|
12
|
+
{ type: row[:type].to_sym, label: label(keys, row), properties: properties(row),
|
13
|
+
state: row[:state].to_sym }
|
14
|
+
end
|
16
15
|
end
|
17
16
|
end
|
18
17
|
|
19
18
|
def constraints
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
raw_indexes do |keys, result|
|
20
|
+
result.select(&method(v4?(keys) ? :v4_filter : :v3_filter)).map do |row|
|
21
|
+
{ type: :uniqueness, label: label(keys, row), properties: properties(row) }
|
22
|
+
end
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
26
|
+
def raw_indexes
|
27
|
+
result = query('CALL db.indexes()', {}, skip_instrumentation: true)
|
28
|
+
yield result.keys, result.reject { |row| row[:type] == 'LOOKUP' }
|
29
|
+
end
|
30
|
+
|
27
31
|
private
|
28
32
|
|
29
33
|
def v4_filter(row)
|
@@ -34,22 +38,22 @@ module ActiveGraph
|
|
34
38
|
row[:type] == 'node_unique_property'
|
35
39
|
end
|
36
40
|
|
37
|
-
def label(
|
38
|
-
if v34?(
|
41
|
+
def label(keys, row)
|
42
|
+
if v34?(keys)
|
39
43
|
row[:label]
|
40
44
|
else
|
41
|
-
(v4?(
|
45
|
+
(v4?(keys) ? row[:labelsOrTypes] : row[:tokenNames]).first
|
42
46
|
end.to_sym
|
43
47
|
end
|
44
48
|
|
45
|
-
def v4?(
|
49
|
+
def v4?(keys)
|
46
50
|
return @v4 unless @v4.nil?
|
47
|
-
@v4 =
|
51
|
+
@v4 = keys.include?(:labelsOrTypes)
|
48
52
|
end
|
49
53
|
|
50
|
-
def v34?(
|
54
|
+
def v34?(keys)
|
51
55
|
return @v34 unless @v34.nil?
|
52
|
-
@v34 =
|
56
|
+
@v34 = keys.include?(:label)
|
53
57
|
end
|
54
58
|
|
55
59
|
def properties(row)
|
@@ -57,9 +57,13 @@ module ActiveGraph
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def handle_migration_error!(e)
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
if e.is_a?(Neo4j::Driver::Exceptions::ClientException) &&
|
61
|
+
e.code == 'Neo.ClientError.Transaction.ForbiddenDueToTransactionType' ||
|
62
|
+
e.message =~ /Cannot perform data updates in a transaction that has performed schema updates./
|
63
|
+
fail MigrationError, "#{e.message}. Please add `disable_transactions!` in your migration file."
|
64
|
+
else
|
65
|
+
fail e
|
66
|
+
end
|
63
67
|
end
|
64
68
|
|
65
69
|
def migration_transaction(&block)
|
@@ -1,15 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'sorted_set'
|
4
|
+
|
1
5
|
module ActiveGraph
|
2
6
|
module Migrations
|
3
7
|
class Runner
|
4
|
-
STATUS_TABLE_FORMAT = '%-10s %-20s %s'
|
5
|
-
SEPARATOR = '--------------------------------------------------'
|
6
|
-
FILE_MISSING = '**** file missing ****'
|
7
|
-
STATUS_TABLE_HEADER = ['Status'
|
8
|
-
UP_MESSAGE = 'up'
|
9
|
-
DOWN_MESSAGE = 'down'
|
10
|
-
INCOMPLETE_MESSAGE = 'incomplete'
|
11
|
-
MIGRATION_RUNNING = {up: 'running'
|
12
|
-
MIGRATION_DONE = {up: 'migrated'
|
8
|
+
STATUS_TABLE_FORMAT = '%-10s %-20s %s'
|
9
|
+
SEPARATOR = '--------------------------------------------------'
|
10
|
+
FILE_MISSING = '**** file missing ****'
|
11
|
+
STATUS_TABLE_HEADER = ['Status', 'Migration ID', 'Migration Name'].freeze
|
12
|
+
UP_MESSAGE = 'up'
|
13
|
+
DOWN_MESSAGE = 'down'
|
14
|
+
INCOMPLETE_MESSAGE = 'incomplete'
|
15
|
+
MIGRATION_RUNNING = {up: 'running', down: 'reverting'}.freeze
|
16
|
+
MIGRATION_DONE = {up: 'migrated', down: 'reverted'}.freeze
|
13
17
|
|
14
18
|
def initialize(options = {})
|
15
19
|
@silenced = options[:silenced] || !!ENV['MIGRATIONS_SILENCED']
|
@@ -253,8 +253,10 @@ module ActiveGraph::Node
|
|
253
253
|
|
254
254
|
def relationship_corresponding_rel(relationship, direction, target_class)
|
255
255
|
self.class.associations.find do |_key, assoc|
|
256
|
-
assoc.
|
257
|
-
|
256
|
+
assoc.direction == direction && (
|
257
|
+
assoc.relationship_class_name == relationship.class.name ||
|
258
|
+
(assoc.relationship_type == relationship.type.to_sym && assoc.target_class == target_class)
|
259
|
+
)
|
258
260
|
end
|
259
261
|
end
|
260
262
|
|
@@ -68,7 +68,7 @@ module ActiveGraph
|
|
68
68
|
|
69
69
|
def init_associations(node, element)
|
70
70
|
element.each_key { |key| node.association_proxy(key).init_cache }
|
71
|
-
node.association_proxy(element.name).init_cache if element.rel_length == ''
|
71
|
+
node.association_proxy(element.name).init_cache if element.rel_length && element.rel_length[:max] == ''
|
72
72
|
end
|
73
73
|
|
74
74
|
def cache_and_init(node, element)
|
@@ -157,14 +157,8 @@ module ActiveGraph
|
|
157
157
|
end
|
158
158
|
|
159
159
|
def relationship_part(association, path_name, rel_length)
|
160
|
-
|
161
|
-
|
162
|
-
length = {max: rel_length}
|
163
|
-
else
|
164
|
-
rel_name = escape("#{path_name}_rel")
|
165
|
-
length = nil
|
166
|
-
end
|
167
|
-
"#{association.arrow_cypher(rel_name, {}, false, false, length)}(#{escape(path_name)})"
|
160
|
+
rel_name = escape("#{path_name}_rel") unless rel_length
|
161
|
+
"#{association.arrow_cypher(rel_name, {}, false, false, rel_length)}(#{escape(path_name)})"
|
168
162
|
end
|
169
163
|
|
170
164
|
def chain
|
@@ -28,7 +28,7 @@ module ActiveGraph
|
|
28
28
|
def validate_each(record, attribute, value)
|
29
29
|
return unless found(record, attribute, value).exists?
|
30
30
|
|
31
|
-
record.errors.add(attribute, :taken, options.except(:case_sensitive, :scope).merge(value: value))
|
31
|
+
record.errors.add(attribute, :taken, **options.except(:case_sensitive, :scope).merge(value: value))
|
32
32
|
end
|
33
33
|
|
34
34
|
def found(record, attribute, value)
|
data/lib/active_graph/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activegraph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 10.0.
|
4
|
+
version: 10.2.0.beta.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Ronge, Brian Underwood, Chris Grigg, Heinrich Klobuczek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "!="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.8.8
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "!="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.8.8
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: orm_adapter
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.5.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sorted_set
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: guard
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +142,14 @@ dependencies:
|
|
128
142
|
requirements:
|
129
143
|
- - "~>"
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version: 1.7.
|
145
|
+
version: 1.7.4
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
150
|
- - "~>"
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version: 1.7.
|
152
|
+
version: 1.7.4
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: os
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -234,6 +248,20 @@ dependencies:
|
|
234
248
|
- - ">="
|
235
249
|
- !ruby/object:Gem::Version
|
236
250
|
version: '0'
|
251
|
+
- !ruby/object:Gem::Dependency
|
252
|
+
name: rspec
|
253
|
+
requirement: !ruby/object:Gem::Requirement
|
254
|
+
requirements:
|
255
|
+
- - "<"
|
256
|
+
- !ruby/object:Gem::Version
|
257
|
+
version: '3.10'
|
258
|
+
type: :development
|
259
|
+
prerelease: false
|
260
|
+
version_requirements: !ruby/object:Gem::Requirement
|
261
|
+
requirements:
|
262
|
+
- - "<"
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
version: '3.10'
|
237
265
|
description: 'A Neo4j OGM (Object-Graph-Mapper) for Ruby heavily inspired by ActiveRecord.
|
238
266
|
|
239
267
|
'
|
@@ -411,11 +439,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
411
439
|
version: '2.5'
|
412
440
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
413
441
|
requirements:
|
414
|
-
- - "
|
442
|
+
- - ">"
|
415
443
|
- !ruby/object:Gem::Version
|
416
|
-
version:
|
444
|
+
version: 1.3.1
|
417
445
|
requirements: []
|
418
|
-
rubygems_version: 3.
|
446
|
+
rubygems_version: 3.3.3
|
419
447
|
signing_key:
|
420
448
|
specification_version: 4
|
421
449
|
summary: A graph database for Ruby
|