activegraph 10.1.1 → 10.2.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65cca8a21c8ecb9dff1f8fdf38ab82bcbc02fb211bc29a1b50f947e1d4126b9f
4
- data.tar.gz: c64ebb3dff76ec6b66eebe3499aef2fb15a1db56cf786e2da250e0ace1e6bcb8
3
+ metadata.gz: c01920a2ca46982b8de50984fbd0a07210ef483a4b933f0de9f4b9c3caa9bb1e
4
+ data.tar.gz: 1a3c0f858a7653a1a30497b5df0ef552a297efb66d6f5ff56ec545a81b666be1
5
5
  SHA512:
6
- metadata.gz: 898089b35cfcf2d101103ada41f27c1884cb00d9169b802526d4573af60cc577a8ddbb3ca71be96d9e54202a95a7a560448b6b27bdd57ff964b6d9e0b4f8b2e5
7
- data.tar.gz: 3c3f46755b637e4cdc663f450dc5d247720cee609ae14fa00de87c01f9c9fe09a96d6e9a2bf9b3967f56460444946b35654061ef4cd24e36d9a7acadd20d7f89
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
- result.first[:versions][0]
6
+ query('CALL dbms.components()', {}, skip_instrumentation: true).first[:versions][0]
9
7
  end
10
8
 
11
9
  def indexes
12
- result = query('CALL db.indexes()', {}, skip_instrumentation: true)
13
-
14
- result.map do |row|
15
- { type: row[:type].to_sym, label: label(result, row), properties: properties(row), state: row[:state].to_sym }
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
- result = query('CALL db.indexes()', {}, skip_instrumentation: true)
21
-
22
- result.select(&method(v4?(result) ? :v4_filter : :v3_filter)).map do |row|
23
- { type: :uniqueness, label: label(result, row), properties: properties(row) }
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(result, row)
38
- if v34?(result)
41
+ def label(keys, row)
42
+ if v34?(keys)
39
43
  row[:label]
40
44
  else
41
- (v4?(result) ? row[:labelsOrTypes] : row[:tokenNames]).first
45
+ (v4?(keys) ? row[:labelsOrTypes] : row[:tokenNames]).first
42
46
  end.to_sym
43
47
  end
44
48
 
45
- def v4?(result)
49
+ def v4?(keys)
46
50
  return @v4 unless @v4.nil?
47
- @v4 = result.keys.include?(:labelsOrTypes)
51
+ @v4 = keys.include?(:labelsOrTypes)
48
52
  end
49
53
 
50
- def v34?(result)
54
+ def v34?(keys)
51
55
  return @v34 unless @v34.nil?
52
- @v34 = result.keys.include?(:label)
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
- fail e unless e.message =~ /Cannot perform data updates in a transaction that has performed schema updates./
61
- fail MigrationError,
62
- "#{e.message}. Please add `disable_transactions!` in your migration file."
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,3 +1,3 @@
1
1
  module ActiveGraph
2
- VERSION = '10.1.1'
2
+ VERSION = '10.2.0.beta.1'
3
3
  end
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.1.1
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: 2021-11-05 00:00:00.000000000 Z
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: '0'
444
+ version: 1.3.1
445
445
  requirements: []
446
- rubygems_version: 3.2.22
446
+ rubygems_version: 3.3.3
447
447
  signing_key:
448
448
  specification_version: 4
449
449
  summary: A graph database for Ruby