activegraph 10.0.0.pre.beta.9 → 10.0.2

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: 8550db7a7318c874038288f06c18b61626de59b1e15ef6da84106c655a765ddc
4
- data.tar.gz: 917fa4fa44b7ece60ddacae791ae73fb70632743092cb51f0efd062d4114a2c2
3
+ metadata.gz: da2d8a7259add3643cf674f25c93580424d614791b68394c6ebd51e936828140
4
+ data.tar.gz: 7c6987932e0bb59d96a1233d51a20748fee03d585cc2fa5dcd45111e17b8fb04
5
5
  SHA512:
6
- metadata.gz: 1d995c7d4ca8bbc0639434f2f284f532554a65d551ce977ee1566d84b3df50b92b2565d99ed9fbb82a3d9b3a425900c813cc16213eec9b8fd0f10e3bfc2432d3
7
- data.tar.gz: c8532396f2b1a154733ff443ea6cd846b690b723cf86db8b37efe8153ebdf71b5fc923bfcf4c2ded43016cdd1a5213fe62222e928768d12e00d0ba5f2ee65d6c
6
+ metadata.gz: 97733e8f86febdfd278a75cbef2561074d14d7d545ce98474f61b8b395a9972e04643b624c0f87b9c132493a316cb8b0a7011e28dc27d918c7bc787681b57b84
7
+ data.tar.gz: b1529b3c7e256ecef44a7006691593fc0a7a8f1e7b7e6de60fb5d22bae6b92a91307d4753d4f9b12fec0a8853df3369f0e1479b7945c035b1f550f9dc7053b64
@@ -3,11 +3,40 @@ 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.0.x] 2020-01-23
6
+ ## [10.0.2] 2020-12-08
7
7
 
8
- - Executing relationship callbacks on relationship deletion.
9
- - When assiging relationships, preserving earlier relationships.
10
- - Enforcing has one constraint on relationships.
8
+ ## Fixed
9
+
10
+ - fixed bad require (https://github.com/neo4jrb/activegraph/issues/1634)
11
+ - removed unused exception class (Thanks @joshjordan)
12
+ - prevented after_commit callbacks from being called multiple times (Thanks @joshjordan)
13
+
14
+ ## [10.0.1] 2020-07-26
15
+
16
+ ## Fixed
17
+
18
+ - fixed incorrect id comparison, which could result in lost relationships (https://github.com/neo4jrb/activegraph/issues/1611)
19
+ - brought back BigDecimalConverter
20
+ - fixed rails template (Thanks @ekampp)
21
+
22
+ ## [10.0.0] 2020-07-06
23
+
24
+ - neo4j 4.0 support (default database only)
25
+ - dropped support for neo4j 3.3 or earlier
26
+ - full bolt support
27
+ - full causal cluster support
28
+ - removal of http support
29
+ - removal of embedded support (neo4j embedded is still supported via bolt)
30
+ - support for a neo4j ruby driver with an api of the official drivers
31
+ - discontinuation of the ``neo4j-core`` gem. Its functionality is replaced partially by ``neo4j-ruby-driver`` and
32
+ partially by ``activegraph``
33
+ - higher naming consistency with ``activerecord`` and the official ``neo4j-java-driver``
34
+ - configuration more consistent with ``activerecord``
35
+ - changed transaction API
36
+ - support for sessions with bookmarks and read and write transaction
37
+ - enforcing has one constraint on relationships
38
+ - better handling of has_many (no deletion and recreation)
39
+ - executing association callbacks on relationship deletion
11
40
 
12
41
  ## [9.6.1] 2019-12-18
13
42
 
data/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  ### Documentation
13
13
 
14
- All new documentation will be done via our [readthedocs](http://neo4jrb.readthedocs.org) site, though some old documentation has yet to be moved from our [wiki](https://github.com/neo4jrb/neo4j/wiki) (also there is the [neo4j-core wiki](https://github.com/neo4jrb/neo4j-core/wiki))
14
+ All new documentation will be done via our [readthedocs](http://neo4jrb.readthedocs.org) site, though some old documentation has yet to be moved from our [wiki](https://github.com/neo4jrb/neo4j/wiki)
15
15
 
16
16
  ### Contact Us
17
17
 
@@ -45,27 +45,31 @@ 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 |
49
- |-------------------|------|-------|---------|----------|
50
- | 1.9.x | Yes | No | No | No |
51
- | 2.0.x | No | Yes | No | No |
52
- | 2.1.x | No | Yes | Yes * | Yes |
53
- | 2.2.x | No | No | Yes | Yes |
54
- | 2.3.x | No | No | Yes | Yes |
55
- | >= 3.0.0 | No | No | No | Yes |
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, 3.5 | No | No | No | Yes | Yes |
57
+ | 4.0 | No | No | No | No | Yes |
58
+ | 4.1 | No | No | No | No | No |
56
59
 
57
60
  `*` 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
58
61
 
59
62
  ## Neo4j feature support
60
63
 
61
- | **Neo4j Feature** | v2.x | v3.x | >= v4.x | >= 8.x |
62
- |----------------------------|--------|------|---------|--------|
63
- | Bolt Protocol | No | No | No | Yes |
64
- | Auth | No | No | Yes | Yes |
65
- | Remote Cypher | Yes | Yes | Yes | Yes |
66
- | Transactions | Yes | Yes | Yes | Yes |
67
- | High Availability | No | Yes | Yes | Yes |
68
- | Embedded JVM support | Yes | Yes | Yes | Yes |
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 |
69
73
 
70
74
  ## Documentation
71
75
 
@@ -38,7 +38,7 @@ DESCRIPTION
38
38
  s.add_development_dependency('guard-rspec')
39
39
  s.add_development_dependency('guard-rubocop')
40
40
  s.add_development_dependency('neo4j-rake_tasks', '>= 0.3.0')
41
- s.add_development_dependency("neo4j-#{ENV['driver'] == 'java' ? 'java' : 'ruby'}-driver", '>= 0.4.1')
41
+ s.add_development_dependency("neo4j-#{ENV['driver'] == 'java' ? 'java' : 'ruby'}-driver", '~> 1.7.0')
42
42
  s.add_development_dependency('os')
43
43
  s.add_development_dependency('pry')
44
44
  s.add_development_dependency('railties', '>= 4.0')
@@ -1,7 +1,7 @@
1
1
  module ActiveGraph
2
2
  module ClassArguments
3
3
  class << self
4
- INVALID_CLASS_ARGUMENT_ERROR = 'option must by String, Symbol, false, nil, or an Array of Symbols/Strings'
4
+ INVALID_CLASS_ARGUMENT_ERROR = 'option must be String, Symbol, false, nil, or an Array of Symbols/Strings'
5
5
 
6
6
  def valid_argument?(class_argument)
7
7
  [NilClass, String, Symbol, FalseClass].include?(class_argument.class) ||
@@ -402,7 +402,7 @@ module ActiveGraph::Node
402
402
  #
403
403
  # This would define the methods: ``#vehicle``, ``#vehicle=``, and ``.vehicle``.
404
404
  #
405
- # See :ref:`#has_many <Neo4j/Node/HasN/ClassMethods#has_many>` for anything
405
+ # See :ref:`#has_many <ActiveGraph/Node/HasN/ClassMethods#has_many>` for anything
406
406
  # not specified here
407
407
  #
408
408
  def has_one(direction, name, options = {}) # rubocop:disable Naming/PredicateName
@@ -21,7 +21,7 @@ module ActiveGraph
21
21
  class RecordNotFound < ActiveGraph::RecordNotFound; end
22
22
 
23
23
  # @return the labels
24
- # @see Neo4j-core
24
+ # @see ActiveGraph::Core
25
25
  def labels
26
26
  @_persisted_obj.labels
27
27
  end
@@ -32,7 +32,7 @@ module ActiveGraph
32
32
  # end
33
33
 
34
34
  # adds one or more labels
35
- # @see Neo4j-core
35
+ # @see ActiveGraph::Core
36
36
  def add_labels(*labels)
37
37
  labels.inject(query_as(:n)) do |query, label|
38
38
  query.set("n:`#{label}`")
@@ -43,7 +43,7 @@ module ActiveGraph
43
43
 
44
44
  # Removes one or more labels
45
45
  # Be careful, don't remove the label representing the Ruby class.
46
- # @see Neo4j-core
46
+ # @see ActiveGraph::Core
47
47
  def remove_labels(*labels)
48
48
  labels.inject(query_as(:n)) do |query, label|
49
49
  query.remove("n:`#{label}`")
@@ -30,8 +30,8 @@ module ActiveGraph::Node
30
30
  end
31
31
 
32
32
  # Increments concurrently a numeric attribute by a centain amount
33
- # @param [Symbol, String] name of the attribute to increment
34
- # @param [Integer, Float] amount to increment
33
+ # @param [Symbol, String] attribute name of the attribute to increment
34
+ # @param [Integer, Float] by amount to increment
35
35
  def concurrent_increment!(attribute, by = 1)
36
36
  increment_by_query! query_as(:n), attribute, by
37
37
  end
@@ -16,7 +16,7 @@ module ActiveGraph
16
16
  attr_reader :source_object, :association, :model, :starting_query
17
17
 
18
18
  # QueryProxy is Node's Cypher DSL. While the name might imply that it creates queries in a general sense,
19
- # it is actually referring to <tt>ActiveGraph::Core::Query</tt>, which is a pure Ruby Cypher DSL provided by the <tt>neo4j-core</tt> gem.
19
+ # it is actually referring to <tt>ActiveGraph::Core::Query</tt>, which is a pure Ruby Cypher DSL provided by the <tt>activegraph</tt> gem.
20
20
  # QueryProxy provides ActiveRecord-like methods for common patterns. When it's not handling CRUD for relationships and queries, it
21
21
  # provides Node's association chaining (`student.lessons.teachers.where(age: 30).hobbies`) and enjoys long walks on the
22
22
  # beach.
@@ -22,6 +22,7 @@ module ActiveGraph
22
22
  class << self
23
23
  def for_clause(clause, arg, model, *args)
24
24
  method_to_call = "for_#{clause}_clause"
25
+ return unless respond_to?(method_to_call)
25
26
 
26
27
  send(method_to_call, arg, model, *args)
27
28
  end
@@ -112,8 +113,6 @@ module ActiveGraph
112
113
  default = [Link.new(clause, arg, *args)]
113
114
 
114
115
  Link.for_clause(clause, arg, model, *args) || default
115
- rescue NoMethodError
116
- default
117
116
  end
118
117
 
119
118
  def converted_keys(model, arg)
@@ -82,7 +82,7 @@ module ActiveGraph
82
82
 
83
83
  alias blank? empty?
84
84
 
85
- # @param [ActiveGraph::Node, ActiveGraph::Node, String] other An instance of a Neo4j.rb model, a Neo4j-core node, or a string uuid
85
+ # @param [ActiveGraph::Node, ActiveGraph::Node, String] other An instance of a Neo4j.rb model, a core node, or a string uuid
86
86
  # @param [String, Symbol] target An identifier of a link in the Cypher chain
87
87
  # @return [Boolean]
88
88
  def include?(other, target = nil)
@@ -49,31 +49,20 @@ module ActiveGraph
49
49
  # Deletes the relationships between all nodes for the last step in the QueryProxy chain and replaces them with relationships to the given nodes.
50
50
  # Executed in the database, callbacks will not be run.
51
51
  def replace_with(node_or_nodes)
52
- node_hash = idify_hash(node_or_nodes)
52
+ node_or_nodes = Array(node_or_nodes).map { |arg| arg.is_a?(ActiveGraph::Node) ? arg : @model.find(arg) }
53
53
  original_ids = self.pluck(:id)
54
- new_nodes = add_rels(node_hash, original_ids)
55
- delete_rels_for_nodes(original_ids - node_hash.keys)
56
- new_nodes | node_hash.values
54
+ delete_rels_for_nodes(original_ids, node_or_nodes.collect(&:id))
55
+ add_rels(node_or_nodes, original_ids)
57
56
  end
58
57
 
59
- def idify_hash(args)
60
- Array(args).reject(&:blank?).flatten.each_with_object({}).with_index do |(arg, hash), inx|
61
- if arg.is_a?(Integer) || arg.is_a?(String)
62
- hash[arg.to_i] = @model.find(arg)
63
- else
64
- key = arg.persisted? ? arg.id : "tmp_#{inx}"
65
- hash[key] = arg
66
- end
67
- end
68
- end
69
-
70
- def add_rels(node_hash, original_ids)
71
- (node_hash.keys - original_ids).map do |id|
72
- node_hash[id] if _create_relation_or_defer(node_hash[id])
58
+ def add_rels(node_or_nodes, original_ids)
59
+ node_or_nodes.map do |obj|
60
+ obj if original_ids.include?(obj.id) || _create_relation_or_defer(obj)
73
61
  end.compact
74
62
  end
75
63
 
76
- def delete_rels_for_nodes(ids)
64
+ def delete_rels_for_nodes(original_ids, new_ids)
65
+ ids = original_ids.select { |id| !new_ids.include?(id) }
77
66
  return unless ids.present?
78
67
  if association.dependent
79
68
  start_object.public_send("dependent_#{association.dependent}_callback", association, ids)
@@ -2,12 +2,13 @@ require 'active_support/notifications'
2
2
  require 'rails/railtie'
3
3
  # Need the action_dispatch railtie to have action_dispatch.rescue_responses initialized correctly
4
4
  require 'action_dispatch/railtie'
5
+ require 'active_graph'
5
6
 
6
7
  module ActiveGraph
7
8
  class Railtie < ::Rails::Railtie
8
9
  def empty_config
9
10
  ActiveSupport::OrderedOptions.new.tap do |cfg|
10
- cfg.driver = ActiveSupport::OrderedOptions.new.tap { |cfg| cfg.config = ActiveSupport::OrderedOptions.new }
11
+ cfg.driver = ActiveSupport::OrderedOptions.new
11
12
  end
12
13
  end
13
14
 
@@ -58,29 +59,29 @@ module ActiveGraph
58
59
  end
59
60
  end
60
61
 
61
- def setup!(neo4j_config = empty_config)
62
- url, path, auth_token, username, password, config =
63
- final_driver_config!(neo4j_config).values_at(:url, :path, :auth_token, :username, :password, :config)
62
+ def setup!(config = empty_config)
63
+ config = final_driver_config!(config)
64
+ scheme = config.delete(:scheme) || 'bolt'
65
+ host = config.delete(:host) || 'localhost'
66
+ port = config.delete(:port) || 7687
67
+ url = config.delete(:url) || URI::Generic.build( scheme: scheme, host: host, port: port ).to_s
68
+ username = config.delete(:username)
69
+ password = config.delete(:password)
70
+ auth_token = config.delete(:auth_token)
64
71
  auth_token ||= username ? Neo4j::Driver::AuthTokens.basic(username, password) : Neo4j::Driver::AuthTokens.none
65
72
  register_neo4j_cypher_logging
66
73
 
67
- Neo4j::Driver::GraphDatabase.driver(url || path || default_driver_path_or_url, auth_token, config)
74
+ method = url.is_a?(Enumerable) ? :routing_driver : :driver
75
+ Neo4j::Driver::GraphDatabase.send(method, url, auth_token, config)
68
76
  end
69
77
 
70
- def final_driver_config!(neo4j_config)
71
- (neo4j_config[:driver].empty? ? yaml_config_data : neo4j_config[:driver]).dup
72
- end
73
-
74
- def default_driver_path_or_url
75
- ENV['NEO4J_URL'] || ENV['NEO4J_PATH'] || 'bolt://localhost:7474'
78
+ def final_driver_config!(config)
79
+ { url: ENV['NEO4J_URL'] }.compact.merge(config[:driver]).merge(yaml_config_data)
76
80
  end
77
81
 
78
82
  def yaml_config_data
79
- @yaml_config_data ||= if yaml_path
80
- HashWithIndifferentAccess.new(YAML.load(ERB.new(yaml_path.read).result)[Rails.env])
81
- else
82
- {}
83
- end
83
+ @yaml_config_data ||=
84
+ yaml_path ? YAML.load(ERB.new(yaml_path.read).result)[Rails.env].transform_keys!(&:to_sym) : {}
84
85
  end
85
86
 
86
87
  def yaml_path
@@ -37,8 +37,8 @@ module ActiveGraph::Relationship
37
37
  end
38
38
 
39
39
  # Increments concurrently a numeric attribute by a centain amount
40
- # @param [Symbol, String] name of the attribute to increment
41
- # @param [Integer, Float] amount to increment
40
+ # @param [Symbol, String] attribute name of the attribute to increment
41
+ # @param [Integer, Float] by amount to increment
42
42
  def concurrent_increment!(attribute, by = 1)
43
43
  increment_by_query! query_as(:r), attribute, by, :r
44
44
  end
@@ -65,7 +65,7 @@ module ActiveGraph::Relationship
65
65
 
66
66
  module ClassMethods
67
67
  # Creates a new relationship between objects
68
- # @param [Hash] props the properties the new relationship should have
68
+ # @param [Hash] args the properties the new relationship should have
69
69
  def create(*args)
70
70
  new(*args).tap(&:save)
71
71
  end
@@ -189,7 +189,7 @@ module ActiveGraph::Shared
189
189
 
190
190
  # Assign a set of attribute definitions, used when subclassing models
191
191
  #
192
- # @param [Array<ActiveGraph::Shared::DeclaredProperties>] The Array of
192
+ # @param [Array<ActiveGraph::Shared::DeclaredProperties>] attributes The Array of
193
193
  # AttributeDefinition instances
194
194
  def attributes=(attributes)
195
195
  @attributes = attributes
@@ -9,7 +9,7 @@ module ActiveGraph
9
9
 
10
10
  included do
11
11
  include ActiveModel::Validations::Callbacks
12
- # after_find is triggered by the `find` method defined in lib/neo4j/node/id_property.rb
12
+ # after_find is triggered by the `find` method defined in lib/active_graph/node/id_property.rb
13
13
  define_model_callbacks :initialize, :find, only: :after
14
14
  define_model_callbacks :create_commit, :update_commit, :destroy_commit, only: :after
15
15
  define_model_callbacks :save, :create, :update, :destroy, :touch
@@ -75,7 +75,7 @@ module ActiveGraph::Shared
75
75
  end.freeze
76
76
  end
77
77
 
78
- # During object wrapping, a props hash is built with string keys but Neo4j-core provides symbols.
78
+ # During object wrapping, a props hash is built with string keys but ActiveGraph::Core provides symbols.
79
79
  # Rather than a `to_s` or `symbolize_keys` during every load, we build a map of symbol-to-string
80
80
  # to speed up the process. This increases memory used by the gem but reduces object allocation and GC, so it is faster
81
81
  # in practice.
@@ -19,9 +19,8 @@ module ActiveGraph::Shared
19
19
  # person.first_name #=> "Chris"
20
20
  # person.last_name #=> "Griego"
21
21
  #
22
- # @param [Hash{#to_s => Object}, #each] attributes Attributes used to
22
+ # @param [Hash{#to_s => Object}, #each] new_attributes Attributes used to
23
23
  # populate the model
24
- # @param [Hash, #[]] options Options that affect mass assignment
25
24
  def assign_attributes(new_attributes = nil)
26
25
  return unless new_attributes.present?
27
26
  new_attributes.each do |name, value|
@@ -30,7 +30,7 @@ module ActiveGraph::Shared
30
30
  # @return [Hash]
31
31
  def props_for_create
32
32
  inject_timestamps!
33
- props_with_defaults = inject_defaults!(properties)
33
+ props_with_defaults = inject_defaults!(props)
34
34
  converted_props = props_for_db(props_with_defaults)
35
35
  return converted_props unless self.class.respond_to?(:default_property_values)
36
36
  inject_primary_key!(converted_props)
@@ -46,8 +46,8 @@ module ActiveGraph::Shared
46
46
  end
47
47
 
48
48
  # Increments a numeric attribute by a centain amount
49
- # @param [Symbol, String] name of the attribute to increment
50
- # @param [Integer, Float] amount to increment
49
+ # @param [Symbol, String] attribute name of the attribute to increment
50
+ # @param [Integer, Float] by amount to increment
51
51
  def increment(attribute, by = 1)
52
52
  self[attribute] ||= 0
53
53
  self[attribute] += by
@@ -55,15 +55,15 @@ module ActiveGraph::Shared
55
55
  end
56
56
 
57
57
  # Convenience method to increment numeric attribute and #save at the same time
58
- # @param [Symbol, String] name of the attribute to increment
59
- # @param [Integer, Float] amount to increment
58
+ # @param [Symbol, String] attribute name of the attribute to increment
59
+ # @param [Integer, Float] by amount to increment
60
60
  def increment!(attribute, by = 1)
61
61
  increment(attribute, by).update_attribute(attribute, self[attribute])
62
62
  end
63
63
 
64
64
  # Increments concurrently a numeric attribute by a centain amount
65
- # @param [Symbol, String] name of the attribute to increment
66
- # @param [Integer, Float] amount to increment
65
+ # @param [Symbol, String] _attribute name of the attribute to increment
66
+ # @param [Integer, Float] _by amount to increment
67
67
  def concurrent_increment!(_attribute, _by = 1)
68
68
  fail 'not_implemented'
69
69
  end
@@ -143,7 +143,7 @@ module ActiveGraph::Shared
143
143
  end
144
144
 
145
145
  # @return [Hash] all defined and none nil properties
146
- def properties
146
+ def props
147
147
  attributes.reject { |_, v| v.nil? }.symbolize_keys
148
148
  end
149
149
 
@@ -132,7 +132,7 @@ module ActiveGraph::Shared
132
132
  # Defines a property on the class
133
133
  #
134
134
  # See active_attr gem for allowed options, e.g which type
135
- # Notice, in Neo4j you don't have to declare properties before using them, see the neo4j-core api.
135
+ # Notice, in ActiveGraph you don't have to declare properties before using them, see the ActiveGraph::Coree api.
136
136
  #
137
137
  # @example Without type
138
138
  # class Person
@@ -69,6 +69,33 @@ module ActiveGraph::Shared
69
69
  end
70
70
  end
71
71
 
72
+ class BigDecimalConverter < BaseConverter
73
+ class << self
74
+ def convert_type
75
+ BigDecimal
76
+ end
77
+
78
+ def db_type
79
+ String
80
+ end
81
+
82
+ def to_db(value)
83
+ case value
84
+ when Rational
85
+ value.to_f.to_d
86
+ when respond_to?(:to_d)
87
+ value.to_d
88
+ else
89
+ BigDecimal(value.to_s)
90
+ end.to_s
91
+ end
92
+
93
+ def to_ruby(value)
94
+ value.to_d
95
+ end
96
+ end
97
+ end
98
+
72
99
  class StringConverter < BaseConverter
73
100
  class << self
74
101
  def convert_type
@@ -5,9 +5,8 @@ require 'active_graph/migration'
5
5
  if !defined?(Rails) && !Rake::Task.task_defined?('environment')
6
6
  desc 'Run a script against the database to perform system-wide changes'
7
7
  task :environment do
8
- require 'active_graph/session_manager'
9
8
  require 'ostruct'
10
- neo4j_url = ENV['NEO4J_URL'] || 'http://localhost:7474'
9
+ neo4j_url = ENV['NEO4J_URL'] || 'bolt://localhost:7687'
11
10
  $LOAD_PATH.unshift File.dirname('./')
12
11
  ActiveGraph::Base.on_establish_driver do
13
12
  Neo4j::Driver::GraphDatabase.driver(neo4j_url)
@@ -8,13 +8,16 @@ module ActiveGraph
8
8
  def close
9
9
  success
10
10
  super
11
- after_commit_registry.each(&:call) unless @failure
12
11
  end
13
12
 
14
13
  def after_commit(&block)
15
14
  after_commit_registry << block
16
15
  end
17
16
 
17
+ def apply_callbacks
18
+ after_commit_registry.each(&:call) unless @failure
19
+ end
20
+
18
21
  private
19
22
 
20
23
  def after_commit_registry
@@ -43,7 +43,7 @@ module ActiveGraph
43
43
  session.send(method, **config) do |tx|
44
44
  self.tx = tx
45
45
  checked_yield(tx, &block)
46
- end
46
+ end.tap { tx.apply_callbacks }
47
47
  end
48
48
 
49
49
  def checked_yield(tx)
@@ -1,3 +1,3 @@
1
1
  module ActiveGraph
2
- VERSION = '10.0.0-beta.9'
2
+ VERSION = '10.0.2'
3
3
  end
@@ -1,4 +1,6 @@
1
1
  class Create<%= @migration_class_name.underscore.camelize %> < ActiveGraph::Migrations::Base
2
+ disable_transactions!
3
+
2
4
  def up
3
5
  add_constraint :<%= class_name %>, :uuid
4
6
  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.0.0.pre.beta.9
4
+ version: 10.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge, Brian Underwood, Chris Grigg, Heinrich Klobuczek
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-14 00:00:00.000000000 Z
11
+ date: 2020-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -126,16 +126,16 @@ dependencies:
126
126
  name: neo4j-ruby-driver
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 0.4.1
131
+ version: 1.7.0
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 0.4.1
138
+ version: 1.7.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: os
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -260,7 +260,6 @@ files:
260
260
  - lib/active_graph/class_arguments.rb
261
261
  - lib/active_graph/config.rb
262
262
  - lib/active_graph/core.rb
263
- - lib/active_graph/core/connection_failed_error.rb
264
263
  - lib/active_graph/core/cypher_error.rb
265
264
  - lib/active_graph/core/entity.rb
266
265
  - lib/active_graph/core/instrumentable.rb
@@ -394,7 +393,7 @@ metadata:
394
393
  changelog_uri: https://github.com/neo4jrb/activegraph/blob/master/CHANGELOG.md
395
394
  source_code_uri: https://github.com/neo4jrb/activegraph/
396
395
  bug_tracker_uri: https://github.com/neo4jrb/activegraph/issues
397
- post_install_message:
396
+ post_install_message:
398
397
  rdoc_options:
399
398
  - "--quiet"
400
399
  - "--title"
@@ -412,12 +411,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
412
411
  version: '2.5'
413
412
  required_rubygems_version: !ruby/object:Gem::Requirement
414
413
  requirements:
415
- - - ">"
414
+ - - ">="
416
415
  - !ruby/object:Gem::Version
417
- version: 1.3.1
416
+ version: '0'
418
417
  requirements: []
419
418
  rubygems_version: 3.1.2
420
- signing_key:
419
+ signing_key:
421
420
  specification_version: 4
422
421
  summary: A graph database for Ruby
423
422
  test_files: []
@@ -1,6 +0,0 @@
1
- module ActiveGraph
2
- module Core
3
- class ConnectionFailedError < StandardError;
4
- end
5
- end
6
- end