neo4j 7.0.12 → 7.0.13

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
  SHA1:
3
- metadata.gz: bf9c94f04964b4b719c6eecfe051067a0b957580
4
- data.tar.gz: 743f534ad03bbb3212db754c78023e3ff5831958
3
+ metadata.gz: df8bb64d46712b18b72eee7f986912e0f78d0c2f
4
+ data.tar.gz: 6cd7303b19d72680cb42e9f14485d666586bfdbe
5
5
  SHA512:
6
- metadata.gz: 4254cc59800eb57234e1606e076060676ee13fba3bde10cf112106280d4c1519b859d924e8eab366367d6c870e96781c4221807f2098033d4bad8122a2223319
7
- data.tar.gz: 5122828aa25d8b72092ad22648775f2361bf12c7698f912cf67ab199dc96c1a78ad07c501940699a549edef5af46d9a23ec20813d562b2eb30aa3548e94b7a7f
6
+ metadata.gz: 425a60cfa9c9b9cd2df77999a71168f29e413e7e5ac270ed32e5a5f93b8d4504aa2875c8db36b0100a26a9b4723e4c10a797bc7fed27b025c9787c99644466b7
7
+ data.tar.gz: 445087632f207eefd9b3e3a9c763a81bc1bf8b971e987e0e896faf7c82b9d975cc9d46ea40e0e68751a9dd7a3edc65cc9233b24ad0c64cccd26aa09205adfbc1
@@ -125,14 +125,14 @@ module Neo4j::ActiveNode
125
125
  on_create_attrs, on_match_attrs, set_attrs = optional_attrs.values_at(*options)
126
126
 
127
127
  neo4j_session.query.merge(n: {self.mapped_label_names => match_attributes})
128
- .on_create_set(n: on_create_props(on_create_attrs))
129
- .on_match_set(n: on_match_props(on_match_attrs))
128
+ .on_create_set(on_create_clause(on_create_attrs))
129
+ .on_match_set(on_match_clause(on_match_attrs))
130
130
  .break.set(n: set_attrs)
131
131
  .pluck(:n).first
132
132
  end
133
133
 
134
134
  def find_or_create(find_attributes, set_attributes = {})
135
- on_create_attributes = set_attributes.reverse_merge(on_create_props(find_attributes))
135
+ on_create_attributes = set_attributes.reverse_merge(find_attributes.merge(self.new(find_attributes).props_for_create))
136
136
 
137
137
  neo4j_session.query.merge(n: {self.mapped_label_names => find_attributes})
138
138
  .on_create_set(n: on_create_attributes)
@@ -155,12 +155,20 @@ module Neo4j::ActiveNode
155
155
 
156
156
  private
157
157
 
158
- def on_create_props(find_attributes)
159
- find_attributes.merge(self.new(find_attributes).props_for_create)
158
+ def on_create_clause(clause)
159
+ if clause.is_a?(Hash)
160
+ {n: clause.merge(self.new(clause).props_for_create)}
161
+ else
162
+ clause
163
+ end
160
164
  end
161
165
 
162
- def on_match_props(match_attributes)
163
- match_attributes.tap { |props| props[:updated_at] = DateTime.now.to_i if attributes_nil_hash.key?('updated_at') }
166
+ def on_match_clause(clause)
167
+ if clause.is_a?(Hash)
168
+ {n: clause.merge(attributes_nil_hash.key?('updated_at') ? {updated_at: Time.new.to_i} : {})}
169
+ else
170
+ clause
171
+ end
164
172
  end
165
173
  end
166
174
  end
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = '7.0.12'
2
+ VERSION = '7.0.13'
3
3
  end
@@ -0,0 +1,19 @@
1
+ require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'neo4j.rb')
2
+
3
+ module Neo4j
4
+ module Generators
5
+ class Migration < ::Neo4j::Generators::Base
6
+ def create_migration_file
7
+ real_file_name = "#{Time.zone.now.strftime('%Y%m%d%H%M%S')}_#{file_name.parameterize}"
8
+ @migration_class_name = file_name.camelize
9
+
10
+ if args[0] == 'force_add_index'
11
+ @content = "force_add_index #{args[1].to_s.classify.to_sym.inspect}, #{args[2].to_sym.inspect}"
12
+ end
13
+
14
+ template 'migration.erb', File.join('db/neo4j/migrate', real_file_name)
15
+ end
16
+ end
17
+ end
18
+ end
19
+
@@ -0,0 +1,9 @@
1
+ class <%= @migration_class_name %> < Neo4j::Migrations::Base
2
+ def up
3
+ <%= @content %>
4
+ end
5
+
6
+ def down
7
+ raise Neo4j::IrreversibleMigration
8
+ end
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.12
4
+ version: 7.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge, Brian Underwood, Chris Grigg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-27 00:00:00.000000000 Z
11
+ date: 2016-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: orm_adapter
@@ -293,6 +293,8 @@ files:
293
293
  - lib/neo4j/type_converters.rb
294
294
  - lib/neo4j/version.rb
295
295
  - lib/neo4j/wrapper.rb
296
+ - lib/rails/generators/neo4j/migration/migration_generator.rb
297
+ - lib/rails/generators/neo4j/migration/templates/migration.erb
296
298
  - lib/rails/generators/neo4j/model/model_generator.rb
297
299
  - lib/rails/generators/neo4j/model/templates/model.erb
298
300
  - lib/rails/generators/neo4j_generator.rb