activegraph 11.0.0.beta.1-java → 11.0.0.beta.2-java

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: def0f5ce7c7930cddaf5f825f8bd390c593acb72e9366cb62c471985d04b4c99
4
- data.tar.gz: 21ba04478d0ae0d355c56ab1ca551d91b05d8e66bd26f3e164d61fede01fa8a5
3
+ metadata.gz: a97e2df0a3e9a49eb2ca103bfe748ddba1eda40b4f6f5e2e443d797e19294864
4
+ data.tar.gz: 1fff9d574b04f38dc3ea38e4ea4bc7dbd56606857ee7a413b64abf497db05ce5
5
5
  SHA512:
6
- metadata.gz: 99d3b195ef17a9f0e5e74f852ef6654a98383e19bf6848660bb7bf02eb6bf22a4873f59c5024c98b1c4ecf57a46574d2db35805214c3fc2840ce503074cb6323
7
- data.tar.gz: 6f11b6290d17c93d3006dec6b6ec982b7e318e945c326e1ffe56f41cff900c2f4efa6f7de834e6585934279847555eabf5be64181ba4864451fda81f3586b075
6
+ metadata.gz: 5f7b364eae28776c62e5c8eb360877ae2c671b53055b500701df8b3187b6bb708e09447a121149bea0a983eb533b86f5b2c924555a7230e1ebe016cd0bbafdef
7
+ data.tar.gz: f8aa6513ec9d35f8c041c1512391d1373ea5b68cf4a70dcde2bd19b0769a71ce28bbe9aacb661cdb7988831c7021e56c1e758fd1692e5bfbaf2bccf4dfe9489c
@@ -36,7 +36,7 @@ DESCRIPTION
36
36
  s.add_dependency('activesupport', '>= 4.0')
37
37
  s.add_dependency('i18n', '!= 1.3.0') # version 1.3.0 introduced a bug with `symbolize_key`
38
38
  s.add_dependency('orm_adapter', '~> 0.5.0')
39
- s.add_dependency("neo4j-java-driver", '~> 4.1.0.beta.1')
39
+ s.add_dependency("neo4j-java-driver", '~> 4.1.0.beta.2')
40
40
  s.add_development_dependency('guard')
41
41
  s.add_development_dependency('guard-rspec')
42
42
  s.add_development_dependency('guard-rubocop')
@@ -114,8 +114,9 @@ module ActiveGraph
114
114
  end
115
115
 
116
116
  def drop_constraints
117
- ActiveGraph::Base.transaction do |tx|
118
- tx.run('CALL db.constraints').each do |record|
117
+ result = ActiveGraph::Base.read_transaction { |tx| tx.run('CALL db.constraints').to_a }
118
+ ActiveGraph::Base.write_transaction do |tx|
119
+ result.each do |record|
119
120
  tx.run("DROP #{record.keys.include?(:name) ? "CONSTRAINT #{record[:name]}" : record[:description]}")
120
121
  end
121
122
  end
@@ -20,11 +20,12 @@ module ActiveGraph
20
20
  end
21
21
 
22
22
  def constraints
23
- read_transaction do
24
- result = query('CALL db.indexes()', {}, skip_instrumentation: true)
25
-
26
- result.select(&method(v4?(result) ? :v4_filter : :v3_filter)).map do |row|
27
- { type: :uniqueness, label: label(result, row), properties: properties(row) }
23
+ session do |session|
24
+ session.read_transaction do |tx|
25
+ tx.run('CALL db.indexes()')
26
+ .select(&method(v4?(tx.run('CALL db.indexes()')) ? :v4_filter : :v3_filter)).map do |row|
27
+ { type: :uniqueness, label: label(tx.run('CALL db.indexes()'), row), properties: properties(row) }
28
+ end
28
29
  end
29
30
  end
30
31
  end
@@ -57,9 +57,12 @@ 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
+ fail MigrationError, "#{e.message}. Please add `disable_transactions!` in your migration file."
63
+ else
64
+ fail e
65
+ end
63
66
  end
64
67
 
65
68
  def migration_transaction(&block)
@@ -63,50 +63,38 @@ namespace :neo4j do
63
63
 
64
64
  COMMENT
65
65
 
66
- def check_neo4j_version_3
67
- if ActiveGraph::Base.version > '3.0.0'
68
- yield
69
- else
70
- puts 'WARNING: This task does not work for versions of Neo4j before 3.0.0'
71
- end
72
- end
73
-
74
66
  desc 'Creates a db/neo4j/schema.yml file which represents the indexes / constraints in the Neo4j DB'
75
67
  task dump: :environment do
76
- check_neo4j_version_3 do
77
- require 'active_graph/migrations/schema'
68
+ require 'active_graph/migrations/schema'
78
69
 
79
- schema_data = ActiveGraph::Migrations::Schema.fetch_schema_data
70
+ schema_data = ActiveGraph::Migrations::Schema.fetch_schema_data
80
71
 
81
- runner = ActiveGraph::Migrations::Runner.new
82
- schema_data[:versions] = runner.complete_migration_versions.sort
72
+ runner = ActiveGraph::Migrations::Runner.new
73
+ schema_data[:versions] = runner.complete_migration_versions.sort
83
74
 
84
- FileUtils.mkdir_p(File.dirname(SCHEMA_YAML_PATH))
85
- File.open(SCHEMA_YAML_PATH, 'w') { |file| file << SCHEMA_YAML_COMMENT + schema_data.to_yaml }
75
+ FileUtils.mkdir_p(File.dirname(SCHEMA_YAML_PATH))
76
+ File.open(SCHEMA_YAML_PATH, 'w') { |file| file << SCHEMA_YAML_COMMENT + schema_data.to_yaml }
86
77
 
87
- puts "Dumped updated schema file to #{SCHEMA_YAML_PATH}"
88
- end
78
+ puts "Dumped updated schema file to #{SCHEMA_YAML_PATH}"
89
79
  end
90
80
 
91
81
  desc "Loads a db/neo4j/schema.yml file into the database\nOptionally removes schema elements which aren't in the schema.yml file (defaults to false)"
92
82
  task :load, [:remove_missing] => :environment do |_t, args|
93
- check_neo4j_version_3 do
94
- require 'active_graph/migrations/schema'
83
+ require 'active_graph/migrations/schema'
95
84
 
96
- args.with_defaults(remove_missing: false)
85
+ args.with_defaults(remove_missing: false)
97
86
 
98
- schema_data = YAML.safe_load(File.read(SCHEMA_YAML_PATH), [Symbol])
87
+ schema_data = YAML.safe_load(File.read(SCHEMA_YAML_PATH), [Symbol])
99
88
 
100
- ActiveGraph::Base.subscribe_to_query(&method(:puts))
89
+ ActiveGraph::Base.subscribe_to_query(&method(:puts))
101
90
 
102
- ActiveGraph::Base.transaction do
103
- ActiveGraph::Migrations::Schema.synchronize_schema_data(schema_data, args[:remove_missing])
104
- end
91
+ ActiveGraph::Base.transaction do
92
+ ActiveGraph::Migrations::Schema.synchronize_schema_data(schema_data, args[:remove_missing])
93
+ end
105
94
 
106
- ActiveGraph::Base.transaction do
107
- runner = ActiveGraph::Migrations::Runner.new
108
- runner.mark_versions_as_complete(schema_data[:versions]) # Run in test mode?
109
- end
95
+ ActiveGraph::Base.transaction do
96
+ runner = ActiveGraph::Migrations::Runner.new
97
+ runner.mark_versions_as_complete(schema_data[:versions]) # Run in test mode?
110
98
  end
111
99
  end
112
100
  end
@@ -5,7 +5,7 @@ module ActiveGraph
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- thread_mattr_accessor :explicit_session, :tx
8
+ thread_mattr_accessor :explicit_session, :tx, :last_bookmark
9
9
  end
10
10
 
11
11
  class_methods do
@@ -13,7 +13,8 @@ module ActiveGraph
13
13
  ActiveGraph::Base.driver.session(**session_config) do |session|
14
14
  self.explicit_session = session
15
15
  yield session
16
- session.last_bookmark
16
+ ensure
17
+ self.last_bookmark = session.last_bookmark
17
18
  end
18
19
  end
19
20
 
@@ -1,3 +1,3 @@
1
1
  module ActiveGraph
2
- VERSION = '11.0.0.beta.1'
2
+ VERSION = '11.0.0.beta.2'
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: 11.0.0.beta.1
4
+ version: 11.0.0.beta.2
5
5
  platform: java
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: 2020-08-16 00:00:00.000000000 Z
11
+ date: 2020-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -71,7 +71,7 @@ dependencies:
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: 4.1.0.beta.1
74
+ version: 4.1.0.beta.2
75
75
  name: neo4j-java-driver
76
76
  type: :runtime
77
77
  prerelease: false
@@ -79,7 +79,7 @@ dependencies:
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 4.1.0.beta.1
82
+ version: 4.1.0.beta.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  requirement: !ruby/object:Gem::Requirement
85
85
  requirements: