neo4j 8.0.0.rc.3 → 8.0.0.rc.4

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: 31ce9e5bebd684174609471aad17082021face51
4
- data.tar.gz: d54842495024cd8df255e9b9a2abcb061ffa03e5
3
+ metadata.gz: 1b6f28cae082dd5d5a620b0457212c98dd62e6b9
4
+ data.tar.gz: c48ce9f1276d4508edab08259ca059d742eba72c
5
5
  SHA512:
6
- metadata.gz: bdaf705709a16d870e42f31dcebd664c33bcd4810341975eaa2ea3d1d1e6ab4b0ec05cba3d9716d54dde200b3400a3a34312d9dc26067ad1d353b0e0e56a240d
7
- data.tar.gz: 0bdee81e2b4e35f3abc1087d778ee01bffed4be0495dd0fda0f3fb23ca4090bdb2d908d514b904c2016002161d286d302fd3f1e83a28fae389cf789ef30d498f
6
+ metadata.gz: 626708e743a96d88e228aee34ce2de20b826cc1b867f4fa13ddf64f3e7b6d767261c319e0b53effd1aa9a038257aa7e9d98e327510b2a3ee21e844147f6a6b4e
7
+ data.tar.gz: 10533ee448ed072bb458b8a15e6373656bdd3235c4b263f02e559a4f504a89f2c6d9a495794872b33a479227e4eddb3e6cb4144db33227f67b1a5d5e4fb7455b
@@ -7,6 +7,20 @@ This project adheres to [Semantic Versioning](http://semver.org/).
7
7
 
8
8
  ## [8.0.0.rc.3] 2016-10-12
9
9
 
10
+ ### Changed
11
+
12
+ - `find_or_create_by` on an association does not look for nodes which aren't related to the node in question (thanks for the report @efatsi / see #1240)
13
+
14
+ ### Fixed
15
+
16
+ - Inconsistent `drop_constraint` and `drop_index` behavior: they were accepting `force` option (like `add_*` methods)
17
+ - `PendingMigrationError` not showing pending migrations versions
18
+ - Fixed `silenced: true` for `Neo4j::Migration::Runner` option, not working properly
19
+ - Removed "strange" inheritance between Neo4j::Migrations::Base and the legacy Neo4j::Migration class
20
+ - Avoid creating the `SchemaMigration` model constraint when it already exists
21
+
22
+ ## [8.0.0.rc.3] 2016-10-12
23
+
10
24
  # Added
11
25
 
12
26
  - `distinct` method for QueryProxy (thanks @ProGM / see #1305)
@@ -148,7 +148,7 @@ module Neo4j
148
148
  result = self.where(params).first
149
149
  return result unless result.nil?
150
150
  Neo4j::ActiveBase.run_transaction do
151
- node = model.find_or_create_by(params)
151
+ node = model.create(params)
152
152
  self << node
153
153
  return node
154
154
  end
@@ -34,11 +34,12 @@ module Neo4j
34
34
 
35
35
  # Inspired/taken from active_record/migration.rb
36
36
  class PendingMigrationError < MigrationError
37
- def initialize
37
+ def initialize(migrations)
38
+ pending_migrations = migrations.join("\n")
38
39
  if rails? && defined?(Rails.env)
39
- super("Migrations are pending. To resolve this issue, run:\n\n #{command_name} neo4j:migrate RAILS_ENV=#{::Rails.env}")
40
+ super("Migrations are pending:\n#{pending_migrations}\n To resolve this issue, run:\n\n #{command_name} neo4j:migrate RAILS_ENV=#{::Rails.env}")
40
41
  else
41
- super("Migrations are pending. To resolve this issue, run:\n\n #{command_name} neo4j:migrate")
42
+ super("Migrations are pending:\n#{pending_migrations}\n To resolve this issue, run:\n\n #{command_name} neo4j:migrate")
42
43
  end
43
44
  end
44
45
 
@@ -11,7 +11,8 @@ module Neo4j
11
11
  class << self
12
12
  def check_for_pending_migrations!
13
13
  runner = Neo4j::Migrations::Runner.new
14
- fail ::Neo4j::PendingMigrationError if runner.pending_migrations?
14
+ pending = runner.pending_migrations
15
+ fail ::Neo4j::PendingMigrationError, pending if pending.any?
15
16
  end
16
17
 
17
18
  attr_accessor :currently_running_migrations
@@ -1,13 +1,14 @@
1
1
  module Neo4j
2
2
  module Migrations
3
- class Base < ::Neo4j::Migration
3
+ class Base
4
4
  include Neo4j::Migrations::Helpers
5
5
  include Neo4j::Migrations::Helpers::Schema
6
6
  include Neo4j::Migrations::Helpers::IdProperty
7
7
  include Neo4j::Migrations::Helpers::Relationships
8
8
 
9
- def initialize(migration_id)
9
+ def initialize(migration_id, options = {})
10
10
  @migration_id = migration_id
11
+ @silenced = options[:silenced]
11
12
  end
12
13
 
13
14
  def migrate(method)
@@ -72,6 +72,10 @@ module Neo4j
72
72
 
73
73
  protected
74
74
 
75
+ def output(*string_format)
76
+ puts format(*string_format) unless @silenced
77
+ end
78
+
75
79
  def transactions?
76
80
  self.class.transaction?
77
81
  end
@@ -24,13 +24,13 @@ module Neo4j
24
24
  def drop_constraint(label, property, options = {})
25
25
  type = options[:type] || :uniqueness
26
26
  label_object = ActiveBase.label_object(label)
27
- fail_missing_constraint_or_index!(:constraint, label, property) if !label_object.constraint?(property)
27
+ fail_missing_constraint_or_index!(:constraint, label, property) if !options[:force] && !label_object.constraint?(property)
28
28
  label_object.drop_constraint(property, type: type)
29
29
  end
30
30
 
31
- def drop_index(label, property)
31
+ def drop_index(label, property, options = {})
32
32
  label_object = ActiveBase.label_object(label)
33
- fail_missing_constraint_or_index!(:index, label, property) if !label_object.index?(property)
33
+ fail_missing_constraint_or_index!(:index, label, property) if !options[:force] && !label_object.index?(property)
34
34
  label_object.drop_index(property)
35
35
  end
36
36
 
@@ -8,9 +8,9 @@ module Neo4j
8
8
  extract_data!
9
9
  end
10
10
 
11
- def create
11
+ def create(options = {})
12
12
  require @file_name
13
- class_name.constantize.new(@version)
13
+ class_name.constantize.new(@version, options)
14
14
  end
15
15
 
16
16
  private
@@ -13,7 +13,8 @@ module Neo4j
13
13
 
14
14
  def initialize(options = {})
15
15
  @silenced = options[:silenced] || !!ENV['MIGRATIONS_SILENCED']
16
- SchemaMigration.mapped_label.create_constraint(:migration_id, type: :unique)
16
+ label = SchemaMigration.mapped_label
17
+ label.create_constraint(:migration_id, type: :unique) unless label.constraint?(:migration_id)
17
18
  @schema_migrations = SchemaMigration.all.to_a
18
19
  @up_versions = SortedSet.new(@schema_migrations.map(&:migration_id))
19
20
  end
@@ -47,8 +48,8 @@ module Neo4j
47
48
  end
48
49
  end
49
50
 
50
- def pending_migrations?
51
- all_migrations.any? { |migration| !up?(migration) }
51
+ def pending_migrations
52
+ all_migrations.select { |migration| !up?(migration) }
52
53
  end
53
54
 
54
55
  def status
@@ -110,7 +111,7 @@ MSG
110
111
 
111
112
  def migrate(direction, migration_file)
112
113
  migration_message(direction, migration_file) do
113
- migration = migration_file.create
114
+ migration = migration_file.create(silenced: @silenced)
114
115
  migration.migrate(direction)
115
116
  end
116
117
  end
@@ -24,7 +24,7 @@ module Neo4j
24
24
  rescue
25
25
  @_deleted = false
26
26
  @attributes = @attributes.dup
27
- tx.mark_failed
27
+ tx.mark_failed if tx
28
28
  raise
29
29
  ensure
30
30
  tx.close if tx
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = '8.0.0.rc.3'
2
+ VERSION = '8.0.0.rc.4'
3
3
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.required_ruby_version = ((RUBY_PLATFORM == 'java') ? '>= 1.9.3' : '>= 2.1.9')
12
12
 
13
13
  s.authors = 'Andreas Ronge, Brian Underwood, Chris Grigg'
14
- s.email = 'andreas.ronge@gmail.com, brian@brian-underwood.codes, chris@subvertallmedia.com'
14
+ s.email = 'andreas.ronge@gmail.com, public@brian-underwood.codes, chris@subvertallmedia.com'
15
15
  s.homepage = 'https://github.com/neo4jrb/neo4j/'
16
16
  s.rubyforge_project = 'neo4j'
17
17
  s.summary = 'A graph database for Ruby'
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: 8.0.0.rc.3
4
+ version: 8.0.0.rc.4
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-10-12 00:00:00.000000000 Z
11
+ date: 2016-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: orm_adapter
@@ -214,7 +214,7 @@ description: 'A Neo4j OGM (Object-Graph-Mapper) for use in Ruby on Rails and Rac
214
214
  frameworks heavily inspired by ActiveRecord.
215
215
 
216
216
  '
217
- email: andreas.ronge@gmail.com, brian@brian-underwood.codes, chris@subvertallmedia.com
217
+ email: andreas.ronge@gmail.com, public@brian-underwood.codes, chris@subvertallmedia.com
218
218
  executables:
219
219
  - neo4j-jars
220
220
  extensions: []