
Migrations
Reported by Andreas Ronge | February 8th, 2010 @ 11:32 AM | in 0.4.1
Should be easy to write migrations in order to keep code and
database in sync.
For example, if we refactor a property that property has to be
changed in the database as well.
Need to keep an version property on the RefNode.
Migrations
Neo4j.migration 1, :create_articles do
up do
Neo4j.ref_node.articles << Articles.new :name => 'article name'
end
down do
Neo4j.ref_node.articles.each {|r| r.del}
end
end
Migrations can be used together with BatchInsert, see ticket #111
Lazy Migrations
Would be cool supporting lazy evaluation of migrations. The
migration is only performed when the node is read.
Example let say that we split up the name property in two
properties: surname and given_name
class Person
include Neo4j::NodeMixin
property :name
end
Changed to
class Person
include Neo4j::NodeMixin
property :surname, :given_name
end
The following migration will be called when a Person node is
read and it does have a version property less then 1
It is evaluated in the context of the node that has been found
needing to be upgraded/downgraded
Person.migration 1, :split_name do
up do
surname = self[:name].split[0]
given_name = self[:name].split[1]
delete_property(:name)
end
down do
name = "self[:given_name] #{self[:surname]}"
delete_property(:surname)
delete_property(:given_name)
end
end
Comments and changes to this ticket
-
Andreas Ronge February 8th, 2010 @ 08:56 PM
- Milestone set to 0.4.1
-
Andreas Ronge February 9th, 2010 @ 10:19 PM
- State changed from new to open
(from [5626168d16140fad10b88e61f061c587bceefd2c]) Impl. Migrations, look at the RSpecs for detail. [#108 state:open] http://github.com/andreasronge/neo4j/commit/5626168d16140fad10b88e6...
-
Andreas Ronge February 12th, 2010 @ 11:50 PM
(from [f62e6f52cb0a989cb5ef42d885c3ddc67c401060]) More RDocs and RSpecs for Migrations [#108 state:open] http://github.com/andreasronge/neo4j/commit/f62e6f52cb0a989cb5ef42d...
-
Andreas Ronge February 13th, 2010 @ 10:47 PM
(from [a7cfc094fe01d8060f49cdea50a5b091bf083f37]) Started to write a RSpec on how migrations with the BatchInserter should look like. Not sure about the API. [#108] http://github.com/andreasronge/neo4j/commit/a7cfc094fe01d8060f49cde...
-
Andreas Ronge February 19th, 2010 @ 08:10 PM
(from [2d54fb8bae6ac2df97d8af51f8a527194650f815]) BatchInserter can now be used in migrations [#111] [#108] http://github.com/andreasronge/neo4j/commit/2d54fb8bae6ac2df97d8af5...
-
Andreas Ronge March 1st, 2010 @ 04:08 PM
(from [3d3e6bbaed4dfa0c557cd891b8c366ff8fc354b5]) Added documentation for Migrations and BatchInserter. Next - use this feature in one of the examples [#111] [#108] http://github.com/andreasronge/neo4j/commit/3d3e6bbaed4dfa0c557cd89...
-
Andreas Ronge March 3rd, 2010 @ 12:04 AM
- State changed from open to resolved
(from [e86e250a2d4cb0debb7a3631c16341341b0be11f]) Updated IMDB example to use migrations. Updated som documentation. [#111 state:resolved] [#108 state:resolved] http://github.com/andreasronge/neo4j/commit/e86e250a2d4cb0debb7a363...
-
Andreas Ronge December 15th, 2011 @ 08:40 AM
- Milestone order changed from 0 to 0
(from [7c0331c0b9f434ce236beaa343d9ed52f476d207]) Merge pull request #108 from vivekprahlad/master
Fix for errors when a Rails model is named 'Property' closes #108
https://github.com/andreasronge/neo4j/commit/7c0331c0b9f434ce236bea...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Neo4j.rb is a graph database framework for JRuby.
It provides:
* Mapping of ruby objects to nodes in networks rather than in tables.
* Storage of ruby object to a file system.
* Fast traversal of relationships between nodes in a hugh node space.
* Transaction with rollbacks support.
* Indexing and quering of ruby objects.
* Integration with Rails
People watching this ticket
Referenced by
-
108 Migrations (from [5626168d16140fad10b88e61f061c587bceefd2c]) Impl. M...
-
108 Migrations (from [f62e6f52cb0a989cb5ef42d885c3ddc67c401060]) More RD...
-
108 Migrations (from [a7cfc094fe01d8060f49cdea50a5b091bf083f37]) Started...
-
111 BatchInserter (from [2d54fb8bae6ac2df97d8af51f8a527194650f815]) BatchIn...
-
108 Migrations (from [2d54fb8bae6ac2df97d8af51f8a527194650f815]) BatchIn...
-
111 BatchInserter (from [3d3e6bbaed4dfa0c557cd891b8c366ff8fc354b5]) Added d...
-
108 Migrations (from [3d3e6bbaed4dfa0c557cd891b8c366ff8fc354b5]) Added d...
-
111 BatchInserter (from [e86e250a2d4cb0debb7a3631c16341341b0be11f]) Updated...
-
108 Migrations (from [e86e250a2d4cb0debb7a3631c16341341b0be11f]) Updated...