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 +4 -4
- data/activegraph.gemspec +1 -1
- data/lib/active_graph/core/label.rb +3 -2
- data/lib/active_graph/core/schema.rb +6 -5
- data/lib/active_graph/migrations/base.rb +6 -3
- data/lib/active_graph/tasks/migration.rake +17 -29
- data/lib/active_graph/transactions.rb +3 -2
- data/lib/active_graph/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a97e2df0a3e9a49eb2ca103bfe748ddba1eda40b4f6f5e2e443d797e19294864
|
4
|
+
data.tar.gz: 1fff9d574b04f38dc3ea38e4ea4bc7dbd56606857ee7a413b64abf497db05ce5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f7b364eae28776c62e5c8eb360877ae2c671b53055b500701df8b3187b6bb708e09447a121149bea0a983eb533b86f5b2c924555a7230e1ebe016cd0bbafdef
|
7
|
+
data.tar.gz: f8aa6513ec9d35f8c041c1512391d1373ea5b68cf4a70dcde2bd19b0769a71ce28bbe9aacb661cdb7988831c7021e56c1e758fd1692e5bfbaf2bccf4dfe9489c
|
data/activegraph.gemspec
CHANGED
@@ -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.
|
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.
|
118
|
-
|
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
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
-
|
61
|
-
|
62
|
-
|
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
|
-
|
77
|
-
require 'active_graph/migrations/schema'
|
68
|
+
require 'active_graph/migrations/schema'
|
78
69
|
|
79
|
-
|
70
|
+
schema_data = ActiveGraph::Migrations::Schema.fetch_schema_data
|
80
71
|
|
81
|
-
|
82
|
-
|
72
|
+
runner = ActiveGraph::Migrations::Runner.new
|
73
|
+
schema_data[:versions] = runner.complete_migration_versions.sort
|
83
74
|
|
84
|
-
|
85
|
-
|
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
|
-
|
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
|
-
|
94
|
-
require 'active_graph/migrations/schema'
|
83
|
+
require 'active_graph/migrations/schema'
|
95
84
|
|
96
|
-
|
85
|
+
args.with_defaults(remove_missing: false)
|
97
86
|
|
98
|
-
|
87
|
+
schema_data = YAML.safe_load(File.read(SCHEMA_YAML_PATH), [Symbol])
|
99
88
|
|
100
|
-
|
89
|
+
ActiveGraph::Base.subscribe_to_query(&method(:puts))
|
101
90
|
|
102
|
-
|
103
|
-
|
104
|
-
|
91
|
+
ActiveGraph::Base.transaction do
|
92
|
+
ActiveGraph::Migrations::Schema.synchronize_schema_data(schema_data, args[:remove_missing])
|
93
|
+
end
|
105
94
|
|
106
|
-
|
107
|
-
|
108
|
-
|
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
|
-
|
16
|
+
ensure
|
17
|
+
self.last_bookmark = session.last_bookmark
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
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: 11.0.0.beta.
|
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-
|
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.
|
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.
|
82
|
+
version: 4.1.0.beta.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|