{"action":"created","comment":{"url":"https://api.github.com/repos/neo4jrb/neo4j/pulls/comments/63357572","id":63357572,"diff_hunk":"@@ -0,0 +1,260 @@\n+Migrations\n+==================\n+\n+Neo4j.rb provides an ``ActiveRecord``-like migration framework and a set of helper methods to manipulate both database schema and data.\n+\n+\n+Generators\n+------------------\n+\n+Migrations can be created by using the built-in Rails generator:\n+\n+.. code-block:: bash\n+\n+  rails generate neo4j:migration RenameUserNameToFirstName\n+\n+This will generate a new file located in ``db/neo4j/migrate/xxxxxxxxxx_rename_user_name_to_first_name.rb``\n+\n+.. code-block:: ruby\n+  class RenameUserNameToFirstName < Neo4j::Migrations::Base\n+    def up\n+    end\n+\n+    def down\n+    end\n+  end\n+\n+In the same way as ``ActiveRecord`` does, you should fill up the ``up`` and ``down`` methods to define the migration and (eventually) the rollback steps.\n+\n+\n+Transactions\n+------------------\n+Every migrations runs inside a transaction by default. So, if some statement fails inside a migration fails, the database rollbacks to the previous state.\n+\n+However this behaviour is not always good. For instance, neo4j doesn't allow schema and data changes in the same transaction.\n+\n+To disable this, you can use the ``disable_transactions!`` helper in your migration definition:\n+\n+.. code-block:: ruby\n+\n+  class SomeMigration < Neo4j::Migrations::Base\n+    disable_transactions!\n+\n+    ...\n+  end\n+\n+Neo4j::Migrations::Helpers\n+------------------\n+\n+#execute\n+~~~~~~\n+\n+Executes a pure neo4j cypher query, interpolating parameters.\n+\n+.. code-block:: ruby\n+\n+  execute('MATCH (n) WHERE n.name = {node_name} RETURN n', node_name: 'John')\n+\n+.. code-block:: ruby\n+\n+  execute('MATCH (n)-[r:`friend`]->() WHERE n.age = 7 DELETE r')\n+\n+\n+#query\n+---------------\n+\n+An alias for ``Neo4j::Session.query``. You can use it as root for the query builder:\n+\n+.. code-block:: ruby\n+\n+  query.match(:n).where(name: 'John').delete(:n)\n+\n+\n+#remove_property\n+---------------\n+\n+Removes a property given a label.\n+\n+:Ruby:\n+  .. code-block:: ruby\n+\n+    remove_property(:User, :money)\n+\n+:Cypher:\n+  .. code-block:: cypher\n+\n+    MATCH (n:`User`) REMOVE n.money","path":"docs/Migrations.rst","position":86,"original_position":86,"commit_id":"77318ec2788c10cf2af06d10b58f4f06b1d1635d","original_commit_id":"77318ec2788c10cf2af06d10b58f4f06b1d1635d","user":{"login":"ProGM","id":5167659,"avatar_url":"https://avatars.githubusercontent.com/u/5167659?v=3","gravatar_id":"","url":"https://api.github.com/users/ProGM","html_url":"https://github.com/ProGM","followers_url":"https://api.github.com/users/ProGM/followers","following_url":"https://api.github.com/users/ProGM/following{/other_user}","gists_url":"https://api.github.com/users/ProGM/gists{/gist_id}","starred_url":"https://api.github.com/users/ProGM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProGM/subscriptions","organizations_url":"https://api.github.com/users/ProGM/orgs","repos_url":"https://api.github.com/users/ProGM/repos","events_url":"https://api.github.com/users/ProGM/events{/privacy}","received_events_url":"https://api.github.com/users/ProGM/received_events","type":"User","site_admin":false},"body":"Uhm, right. I have to check for output.","created_at":"2016-05-16T14:04:40Z","updated_at":"2016-05-16T14:04:41Z","html_url":"https://github.com/neo4jrb/neo4j/pull/1197#discussion_r63357572","pull_request_url":"https://api.github.com/repos/neo4jrb/neo4j/pulls/1197","_links":{"self":{"href":"https://api.github.com/repos/neo4jrb/neo4j/pulls/comments/63357572"},"html":{"href":"https://github.com/neo4jrb/neo4j/pull/1197#discussion_r63357572"},"pull_request":{"href":"https://api.github.com/repos/neo4jrb/neo4j/pulls/1197"}}},"pull_request":{"url":"https://api.github.com/repos/neo4jrb/neo4j/pulls/1197","id":69281280,"html_url":"https://github.com/neo4jrb/neo4j/pull/1197","diff_url":"https://github.com/neo4jrb/neo4j/pull/1197.diff","patch_url":"https://github.com/neo4jrb/neo4j/pull/1197.patch","issue_url":"https://api.github.com/repos/neo4jrb/neo4j/issues/1197","number":1197,"state":"open","locked":false,"title":"Neo4j migrations","user":{"login":"ProGM","id":5167659,"avatar_url":"https://avatars.githubusercontent.com/u/5167659?v=3","gravatar_id":"","url":"https://api.github.com/users/ProGM","html_url":"https://github.com/ProGM","followers_url":"https://api.github.com/users/ProGM/followers","following_url":"https://api.github.com/users/ProGM/following{/other_user}","gists_url":"https://api.github.com/users/ProGM/gists{/gist_id}","starred_url":"https://api.github.com/users/ProGM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProGM/subscriptions","organizations_url":"https://api.github.com/users/ProGM/orgs","repos_url":"https://api.github.com/users/ProGM/repos","events_url":"https://api.github.com/users/ProGM/events{/privacy}","received_events_url":"https://api.github.com/users/ProGM/received_events","type":"User","site_admin":false},"body":"This pull introduces an `ActiveRecord` like migration method.\r\n\r\nIt's W.I.P., but I have a small thing I want to discuss before proceeding:\r\n\r\nI'm using this conventions: migration files are searched in `db/neo4j/migrate` folder using the same strategy as ActiveRecord.\r\nMigrations state is saved in a `SchemaMigration` node.\r\n\r\nSince i wanted to copy the ActiveRecord implementation, I created this set of tasks:\r\n\r\n```bash\r\nrake neo4j::migrate # Alias of ::all\r\nrake neo4j::migrate::all\r\nrake neo4j::migrate::up VERSION=some_version\r\nrake neo4j::migrate::down VERSION=some_version\r\nrake neo4j::rollback\r\n```\r\n\r\nHowever, the first one is conflicting the current neo4j migration task. For now, I renamed it `rake neo4j::legacy_migrate`. What do you think about it?\r\n\r\nPings:\r\n@cheerfulstoic\r\n@subvertallchris\r\n","created_at":"2016-05-08T22:09:25Z","updated_at":"2016-05-16T14:04:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe29c6f4ec89f289674747e27e06039d902a8fa5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/neo4jrb/neo4j/pulls/1197/commits","review_comments_url":"https://api.github.com/repos/neo4jrb/neo4j/pulls/1197/comments","review_comment_url":"https://api.github.com/repos/neo4jrb/neo4j/pulls/comments{/number}","comments_url":"https://api.github.com/repos/neo4jrb/neo4j/issues/1197/comments","statuses_url":"https://api.github.com/repos/neo4jrb/neo4j/statuses/77318ec2788c10cf2af06d10b58f4f06b1d1635d","head":{"label":"neo4jrb:migrations","ref":"migrations","sha":"77318ec2788c10cf2af06d10b58f4f06b1d1635d","user":{"login":"neo4jrb","id":8579795,"avatar_url":"https://avatars.githubusercontent.com/u/8579795?v=3","gravatar_id":"","url":"https://api.github.com/users/neo4jrb","html_url":"https://github.com/neo4jrb","followers_url":"https://api.github.com/users/neo4jrb/followers","following_url":"https://api.github.com/users/neo4jrb/following{/other_user}","gists_url":"https://api.github.com/users/neo4jrb/gists{/gist_id}","starred_url":"https://api.github.com/users/neo4jrb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neo4jrb/subscriptions","organizations_url":"https://api.github.com/users/neo4jrb/orgs","repos_url":"https://api.github.com/users/neo4jrb/repos","events_url":"https://api.github.com/users/neo4jrb/events{/privacy}","received_events_url":"https://api.github.com/users/neo4jrb/received_events","type":"Organization","site_admin":false},"repo":{"id":20724,"name":"neo4j","full_name":"neo4jrb/neo4j","owner":{"login":"neo4jrb","id":8579795,"avatar_url":"https://avatars.githubusercontent.com/u/8579795?v=3","gravatar_id":"","url":"https://api.github.com/users/neo4jrb","html_url":"https://github.com/neo4jrb","followers_url":"https://api.github.com/users/neo4jrb/followers","following_url":"https://api.github.com/users/neo4jrb/following{/other_user}","gists_url":"https://api.github.com/users/neo4jrb/gists{/gist_id}","starred_url":"https://api.github.com/users/neo4jrb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neo4jrb/subscriptions","organizations_url":"https://api.github.com/users/neo4jrb/orgs","repos_url":"https://api.github.com/users/neo4jrb/repos","events_url":"https://api.github.com/users/neo4jrb/events{/privacy}","received_events_url":"https://api.github.com/users/neo4jrb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/neo4jrb/neo4j","description":"An active model wrapper for the Neo4j Graph Database for Ruby.","fork":false,"url":"https://api.github.com/repos/neo4jrb/neo4j","forks_url":"https://api.github.com/repos/neo4jrb/neo4j/forks","keys_url":"https://api.github.com/repos/neo4jrb/neo4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neo4jrb/neo4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neo4jrb/neo4j/teams","hooks_url":"https://api.github.com/repos/neo4jrb/neo4j/hooks","issue_events_url":"https://api.github.com/repos/neo4jrb/neo4j/issues/events{/number}","events_url":"https://api.github.com/repos/neo4jrb/neo4j/events","assignees_url":"https://api.github.com/repos/neo4jrb/neo4j/assignees{/user}","branches_url":"https://api.github.com/repos/neo4jrb/neo4j/branches{/branch}","tags_url":"https://api.github.com/repos/neo4jrb/neo4j/tags","blobs_url":"https://api.github.com/repos/neo4jrb/neo4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neo4jrb/neo4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neo4jrb/neo4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/neo4jrb/neo4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neo4jrb/neo4j/statuses/{sha}","languages_url":"https://api.github.com/repos/neo4jrb/neo4j/languages","stargazers_url":"https://api.github.com/repos/neo4jrb/neo4j/stargazers","contributors_url":"https://api.github.com/repos/neo4jrb/neo4j/contributors","subscribers_url":"https://api.github.com/repos/neo4jrb/neo4j/subscribers","subscription_url":"https://api.github.com/repos/neo4jrb/neo4j/subscription","commits_url":"https://api.github.com/repos/neo4jrb/neo4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/neo4jrb/neo4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/neo4jrb/neo4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/neo4jrb/neo4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/neo4jrb/neo4j/contents/{+path}","compare_url":"https://api.github.com/repos/neo4jrb/neo4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neo4jrb/neo4j/merges","archive_url":"https://api.github.com/repos/neo4jrb/neo4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neo4jrb/neo4j/downloads","issues_url":"https://api.github.com/repos/neo4jrb/neo4j/issues{/number}","pulls_url":"https://api.github.com/repos/neo4jrb/neo4j/pulls{/number}","milestones_url":"https://api.github.com/repos/neo4jrb/neo4j/milestones{/number}","notifications_url":"https://api.github.com/repos/neo4jrb/neo4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neo4jrb/neo4j/labels{/name}","releases_url":"https://api.github.com/repos/neo4jrb/neo4j/releases{/id}","deployments_url":"https://api.github.com/repos/neo4jrb/neo4j/deployments","created_at":"2008-05-30T10:44:36Z","updated_at":"2016-05-13T00:53:38Z","pushed_at":"2016-05-16T12:46:07Z","git_url":"git://github.com/neo4jrb/neo4j.git","ssh_url":"git@github.com:neo4jrb/neo4j.git","clone_url":"https://github.com/neo4jrb/neo4j.git","svn_url":"https://github.com/neo4jrb/neo4j","homepage":"http://neo4jrb.io","size":47682,"stargazers_count":1036,"watchers_count":1036,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":197,"mirror_url":null,"open_issues_count":105,"forks":197,"open_issues":105,"watchers":1036,"default_branch":"master"}},"base":{"label":"neo4jrb:master","ref":"master","sha":"0d0a9a6a78d8bfe0881636c75912d52b84bcee59","user":{"login":"neo4jrb","id":8579795,"avatar_url":"https://avatars.githubusercontent.com/u/8579795?v=3","gravatar_id":"","url":"https://api.github.com/users/neo4jrb","html_url":"https://github.com/neo4jrb","followers_url":"https://api.github.com/users/neo4jrb/followers","following_url":"https://api.github.com/users/neo4jrb/following{/other_user}","gists_url":"https://api.github.com/users/neo4jrb/gists{/gist_id}","starred_url":"https://api.github.com/users/neo4jrb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neo4jrb/subscriptions","organizations_url":"https://api.github.com/users/neo4jrb/orgs","repos_url":"https://api.github.com/users/neo4jrb/repos","events_url":"https://api.github.com/users/neo4jrb/events{/privacy}","received_events_url":"https://api.github.com/users/neo4jrb/received_events","type":"Organization","site_admin":false},"repo":{"id":20724,"name":"neo4j","full_name":"neo4jrb/neo4j","owner":{"login":"neo4jrb","id":8579795,"avatar_url":"https://avatars.githubusercontent.com/u/8579795?v=3","gravatar_id":"","url":"https://api.github.com/users/neo4jrb","html_url":"https://github.com/neo4jrb","followers_url":"https://api.github.com/users/neo4jrb/followers","following_url":"https://api.github.com/users/neo4jrb/following{/other_user}","gists_url":"https://api.github.com/users/neo4jrb/gists{/gist_id}","starred_url":"https://api.github.com/users/neo4jrb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neo4jrb/subscriptions","organizations_url":"https://api.github.com/users/neo4jrb/orgs","repos_url":"https://api.github.com/users/neo4jrb/repos","events_url":"https://api.github.com/users/neo4jrb/events{/privacy}","received_events_url":"https://api.github.com/users/neo4jrb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/neo4jrb/neo4j","description":"An active model wrapper for the Neo4j Graph Database for Ruby.","fork":false,"url":"https://api.github.com/repos/neo4jrb/neo4j","forks_url":"https://api.github.com/repos/neo4jrb/neo4j/forks","keys_url":"https://api.github.com/repos/neo4jrb/neo4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neo4jrb/neo4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neo4jrb/neo4j/teams","hooks_url":"https://api.github.com/repos/neo4jrb/neo4j/hooks","issue_events_url":"https://api.github.com/repos/neo4jrb/neo4j/issues/events{/number}","events_url":"https://api.github.com/repos/neo4jrb/neo4j/events","assignees_url":"https://api.github.com/repos/neo4jrb/neo4j/assignees{/user}","branches_url":"https://api.github.com/repos/neo4jrb/neo4j/branches{/branch}","tags_url":"https://api.github.com/repos/neo4jrb/neo4j/tags","blobs_url":"https://api.github.com/repos/neo4jrb/neo4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neo4jrb/neo4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neo4jrb/neo4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/neo4jrb/neo4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neo4jrb/neo4j/statuses/{sha}","languages_url":"https://api.github.com/repos/neo4jrb/neo4j/languages","stargazers_url":"https://api.github.com/repos/neo4jrb/neo4j/stargazers","contributors_url":"https://api.github.com/repos/neo4jrb/neo4j/contributors","subscribers_url":"https://api.github.com/repos/neo4jrb/neo4j/subscribers","subscription_url":"https://api.github.com/repos/neo4jrb/neo4j/subscription","commits_url":"https://api.github.com/repos/neo4jrb/neo4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/neo4jrb/neo4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/neo4jrb/neo4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/neo4jrb/neo4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/neo4jrb/neo4j/contents/{+path}","compare_url":"https://api.github.com/repos/neo4jrb/neo4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neo4jrb/neo4j/merges","archive_url":"https://api.github.com/repos/neo4jrb/neo4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neo4jrb/neo4j/downloads","issues_url":"https://api.github.com/repos/neo4jrb/neo4j/issues{/number}","pulls_url":"https://api.github.com/repos/neo4jrb/neo4j/pulls{/number}","milestones_url":"https://api.github.com/repos/neo4jrb/neo4j/milestones{/number}","notifications_url":"https://api.github.com/repos/neo4jrb/neo4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neo4jrb/neo4j/labels{/name}","releases_url":"https://api.github.com/repos/neo4jrb/neo4j/releases{/id}","deployments_url":"https://api.github.com/repos/neo4jrb/neo4j/deployments","created_at":"2008-05-30T10:44:36Z","updated_at":"2016-05-13T00:53:38Z","pushed_at":"2016-05-16T12:46:07Z","git_url":"git://github.com/neo4jrb/neo4j.git","ssh_url":"git@github.com:neo4jrb/neo4j.git","clone_url":"https://github.com/neo4jrb/neo4j.git","svn_url":"https://github.com/neo4jrb/neo4j","homepage":"http://neo4jrb.io","size":47682,"stargazers_count":1036,"watchers_count":1036,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":197,"mirror_url":null,"open_issues_count":105,"forks":197,"open_issues":105,"watchers":1036,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/neo4jrb/neo4j/pulls/1197"},"html":{"href":"https://github.com/neo4jrb/neo4j/pull/1197"},"issue":{"href":"https://api.github.com/repos/neo4jrb/neo4j/issues/1197"},"comments":{"href":"https://api.github.com/repos/neo4jrb/neo4j/issues/1197/comments"},"review_comments":{"href":"https://api.github.com/repos/neo4jrb/neo4j/pulls/1197/comments"},"review_comment":{"href":"https://api.github.com/repos/neo4jrb/neo4j/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/neo4jrb/neo4j/pulls/1197/commits"},"statuses":{"href":"https://api.github.com/repos/neo4jrb/neo4j/statuses/77318ec2788c10cf2af06d10b58f4f06b1d1635d"}}}}