andreasronge edited this page May 2, 2012 · 5 revisions
Clone this wiki locally

Change dependency in your Gemfile

You can also specify which neo4j java version it should use.

gen 'neo4j', '2.0.0'
gem 'neo4j-community', '1.7.0'

Upgrade to new database version

You can use the neo4j-upgrade command to upgrade the database.


bundle exec neo4j-upgrade db/neo4j-development

See Neo4j Upgrade Instructions

Changes in 2.0

Database layout

  • Renamed size property on rule nodes to count (_count__all__classname => _size__all__classname)
  • Rename of has_n(...).to(other_class) generated relationships.

API changes

  • The rels and rel method always takes an direction as first argument (default to `both`)
  • You declare index by using the property class method, example property :name, :index => :exact
  • alias Neo4j::Model is not available (use Neo4j::Rails::Model)

Upgrade to 2.0

The 2.0 release contains a number of changes which means that just running the neo4j-upgrade command is not enough. There is a rake task which can help doing this for you.

For a rails project, add the following line to your Rakefile

require 'neo4j/tasks/neo4j'

Make sure that you don’t have any Rails initializers using the database before running the neo4j rake task.

Set which model classes should be upgraded, using the NEO4J_CLASSES environment variable

$ export NEO4J_CLASSES="Person, Order, Post"

If you are using multitenancy, you need to upgrade each multitenancy node. You do that by setting the NEO4J_MULTI_TENANCY_CLASSES environment variable:


Run the rake script:

bundle exec rake neo4j:upgrade_v2