neo4j 8.0.0.alpha.4 → 8.0.0.alpha.5

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: bd2973cc137423aab039e28ea9e4408447277665
4
- data.tar.gz: 3d62800551e950fbdaadf39c6893f88371247d56
3
+ metadata.gz: 35366c5049bd09b2d9172d7f174576aacb39b3ab
4
+ data.tar.gz: 3e19875b85dcc4de4a7f5f1a21d9351db2a66c03
5
5
  SHA512:
6
- metadata.gz: ab42853f116ac28744c2d1fba3e7753a4361c677269615e4ee54b5c828e8106220106ba951bffec8a0b13d27962c046f837c0ee68fbb097b3044ec2b07cdcf5b
7
- data.tar.gz: ae0c2386e659388839510a7c9f573a922c18772455726b3ce53218f9596850b68f5fe89f183d60447a7281e0daa1b018bfbf9be6db24cf18ca7f33d082f68ff0
6
+ metadata.gz: 48be8c4082aa6603f6a5a09ecfd6173707f90fe228e1f7e2dd1fedd95de7e00b557a8287b4d5c375e3d1f25b745b7997c7132c919056e913fdff27ac81126596
7
+ data.tar.gz: d92edef01fa0175833fc0849ae67416681abd01483131100437973860453037fe0991b361d98bc22e1e9d72426cdf658f8f8d839887583df0118782b108dda00
@@ -34,12 +34,12 @@ module Neo4j
34
34
  end
35
35
 
36
36
  def new_transaction
37
- Neo4j::ModelSchema.validate_model_schema!
37
+ validate_model_schema!
38
38
  Neo4j::Transaction.new(current_session)
39
39
  end
40
40
 
41
41
  def new_query(options = {})
42
- Neo4j::ModelSchema.validate_model_schema!
42
+ validate_model_schema!
43
43
  Neo4j::Core::Query.new({session: current_session}.merge(options))
44
44
  end
45
45
 
@@ -52,7 +52,7 @@ module Neo4j
52
52
  end
53
53
 
54
54
  def current_transaction
55
- Neo4j::ModelSchema.validate_model_schema!
55
+ validate_model_schema!
56
56
  Neo4j::Transaction.current_for(current_session)
57
57
  end
58
58
 
@@ -63,6 +63,12 @@ module Neo4j
63
63
  def logger
64
64
  @logger ||= (Neo4j::Config[:logger] || ActiveSupport::Logger.new(STDOUT))
65
65
  end
66
+
67
+ private
68
+
69
+ def validate_model_schema!
70
+ Neo4j::ModelSchema.validate_model_schema! unless Neo4j::Migrations.currently_running_migrations
71
+ end
66
72
  end
67
73
  end
68
74
  end
@@ -7,13 +7,17 @@ module Neo4j
7
7
  autoload :Runner
8
8
  autoload :SchemaMigration
9
9
 
10
- def self.check_for_pending_migrations!
11
- runner = Neo4j::Migrations::Runner.new
12
- fail ::Neo4j::PendingMigrationError if runner.pending_migrations?
13
- end
10
+ class << self
11
+ def check_for_pending_migrations!
12
+ runner = Neo4j::Migrations::Runner.new
13
+ fail ::Neo4j::PendingMigrationError if runner.pending_migrations?
14
+ end
15
+
16
+ attr_accessor :currently_running_migrations
14
17
 
15
- def self.maintain_test_schema!
16
- Neo4j::Migrations::Runner.new(silenced: true).all
18
+ def maintain_test_schema!
19
+ Neo4j::Migrations::Runner.new(silenced: true).all
20
+ end
17
21
  end
18
22
  end
19
23
  end
data/lib/neo4j/railtie.rb CHANGED
@@ -54,7 +54,9 @@ module Neo4j
54
54
  session_types = cfg.sessions.map { |session_opts| session_opts[:type] }
55
55
 
56
56
  register_neo4j_cypher_logging(session_types)
57
- Neo4j::Migrations.check_for_pending_migrations! if Rails.env.development? && Neo4j::Config.fail_on_pending_migrations
57
+ if Rails.env.development? && !Neo4j::Migrations.currently_running_migrations && Neo4j::Config.fail_on_pending_migrations
58
+ Neo4j::Migrations.check_for_pending_migrations!
59
+ end
58
60
  end
59
61
 
60
62
  TYPE_SUBSCRIBERS = {
@@ -10,6 +10,10 @@ unless Rake::Task.task_defined?('environment')
10
10
  end
11
11
 
12
12
  namespace :neo4j do
13
+ task :allow_migrations do
14
+ Neo4j::Migrations.currently_running_migrations = true
15
+ end
16
+
13
17
  desc 'Run a script against the database to perform system-wide changes'
14
18
  task :legacy_migrate, [:task_name, :subtask] => :environment do |_, args|
15
19
  path = Rake.original_dir
@@ -32,46 +36,46 @@ namespace :neo4j do
32
36
  end
33
37
 
34
38
  desc 'A shortcut for neo4j::migrate::all'
35
- task migrate: :environment do
39
+ task :migrate do
36
40
  Rake::Task['neo4j:migrate:all'].invoke
37
41
  end
38
42
 
39
43
  namespace :migrate do
40
44
  desc 'Run all pending migrations'
41
- task all: :environment do
45
+ task all: [:allow_migrations, :environment] do
42
46
  runner = Neo4j::Migrations::Runner.new
43
47
  runner.all
44
48
  end
45
49
 
46
50
  desc 'Run a migration given its VERSION'
47
- task up: :environment do
51
+ task up: [:allow_migrations, :environment] do
48
52
  version = ENV['VERSION'] || fail(ArgumentError, 'VERSION is required')
49
53
  runner = Neo4j::Migrations::Runner.new
50
54
  runner.up version
51
55
  end
52
56
 
53
57
  desc 'Revert a migration given its VERSION'
54
- task down: :environment do
58
+ task down: [:allow_migrations, :environment] do
55
59
  version = ENV['VERSION'] || fail(ArgumentError, 'VERSION is required')
56
60
  runner = Neo4j::Migrations::Runner.new
57
61
  runner.down version
58
62
  end
59
63
 
60
64
  desc 'Print a report of migrations status'
61
- task status: :environment do
65
+ task status: [:allow_migrations, :environment] do
62
66
  runner = Neo4j::Migrations::Runner.new
63
67
  runner.status
64
68
  end
65
69
 
66
70
  desc 'Resolve an incomplete version state'
67
- task resolve: :environment do
71
+ task resolve: [:allow_migrations, :environment] do
68
72
  version = ENV['VERSION'] || fail(ArgumentError, 'VERSION is required')
69
73
  runner = Neo4j::Migrations::Runner.new
70
74
  runner.resolve version
71
75
  end
72
76
 
73
77
  desc 'Resolve an incomplete version state'
74
- task reset: :environment do
78
+ task reset: [:allow_migrations, :environment] do
75
79
  version = ENV['VERSION'] || fail(ArgumentError, 'VERSION is required')
76
80
  runner = Neo4j::Migrations::Runner.new
77
81
  runner.reset version
@@ -79,7 +83,7 @@ namespace :neo4j do
79
83
  end
80
84
 
81
85
  desc 'Rollbacks migrations given a STEP number'
82
- task :rollback, :environment do
86
+ task :rollback, [:allow_migrations, :environment] do
83
87
  steps = (ENV['STEP'] || 1).to_i
84
88
  runner = Neo4j::Migrations::Runner.new
85
89
  runner.rollback(steps)
@@ -96,7 +100,7 @@ namespace :neo4j do
96
100
  fail 'Label must be specified' if label.blank?
97
101
  fail 'Property name must be specified' if property_name.blank?
98
102
 
99
- migration_class_name = "ForceCreate#{label.camelize}#{property_name.camelize}#{index_or_constraint.capitalize}"
103
+ migration_class_name = "ForceCreate#{label.camelize}#{property_name.camelize}#{index_or_constraint.capitalize}".gsub('::', '')
100
104
 
101
105
  require 'fileutils'
102
106
  FileUtils.mkdir_p('db/neo4j/migrate')
data/lib/neo4j/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = '8.0.0.alpha.4'
2
+ VERSION = '8.0.0.alpha.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.0.alpha.4
4
+ version: 8.0.0.alpha.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge, Brian Underwood, Chris Grigg