activegraph 10.1.1 → 10.2.0.beta.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/lib/active_graph/core/schema.rb +22 -18
- data/lib/active_graph/migrations/base.rb +7 -3
- data/lib/active_graph/version.rb +1 -1
- metadata +5 -5
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
|
@@ -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)
|
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.
|
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
|
@@ -439,11 +439,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
439
439
|
version: '2.5'
|
440
440
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
441
441
|
requirements:
|
442
|
-
- - "
|
442
|
+
- - ">"
|
443
443
|
- !ruby/object:Gem::Version
|
444
|
-
version:
|
444
|
+
version: 1.3.1
|
445
445
|
requirements: []
|
446
|
-
rubygems_version: 3.
|
446
|
+
rubygems_version: 3.3.3
|
447
447
|
signing_key:
|
448
448
|
specification_version: 4
|
449
449
|
summary: A graph database for Ruby
|