{"action":"closed","issue":{"url":"https://api.github.com/repos/piranha/nomad/issues/6","labels_url":"https://api.github.com/repos/piranha/nomad/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/piranha/nomad/issues/6/comments","events_url":"https://api.github.com/repos/piranha/nomad/issues/6/events","html_url":"https://github.com/piranha/nomad/issues/6","id":10015171,"number":6,"title":"Incremental development and automated deployment","user":{"login":"pcdinh","id":42888,"avatar_url":"https://avatars.githubusercontent.com/u/42888?v=3","gravatar_id":"","url":"https://api.github.com/users/pcdinh","html_url":"https://github.com/pcdinh","followers_url":"https://api.github.com/users/pcdinh/followers","following_url":"https://api.github.com/users/pcdinh/following{/other_user}","gists_url":"https://api.github.com/users/pcdinh/gists{/gist_id}","starred_url":"https://api.github.com/users/pcdinh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcdinh/subscriptions","organizations_url":"https://api.github.com/users/pcdinh/orgs","repos_url":"https://api.github.com/users/pcdinh/repos","events_url":"https://api.github.com/users/pcdinh/events{/privacy}","received_events_url":"https://api.github.com/users/pcdinh/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2013-01-16T11:44:09Z","updated_at":"2015-03-16T14:27:08Z","closed_at":"2015-03-16T14:27:08Z","body":"Suppose that I am working a small Python development team, says 5 developers\r\n\r\nEach developer works on a module. As a result, they work on different migration scripts.\r\n\r\nLet say the current version is 1.2.0. Using Nomad, I will create a new directory and file named /migration/1.2.0/data.sql\r\n\r\nThe coding will be incremental. So 5 developers will deploy their code changes, code merges all day using a automated deployment tool which run nomad every time it is executed.\r\n\r\nIn that scenario, I expect that\r\n\r\n+ Nomad will understand version schema which is represented by directories in /migration. Ex: \r\n++ /migration/0.1.0\r\n++ /migration/0.9.0\r\n++ /migration/0.10.2\r\n++ /migration/0.10.3\r\n++ /migration/1.2.0\r\n\r\n(in that order)\r\n\r\nNomad supports natural sorting so it is not a problem.\r\n+ Nomad is able to detect if any version was migrated before and what is the current version to be migrated. Part of the requirement is done already because Nomad save the directory name (0.1.0, 1.2.0 ....) in \"nomad\" table to keep track of what has been run.\r\n\r\n+ Nomad runs everything in the migration child directory as a whole so it can not detect if there is anything change to run it again. Therefore it is unable to use in automated incremental deployment (nightly build or run unit tests in an automated way)\r\n\r\nTo support this feature, Nomad need to support\r\n\r\n+ Named queries. Queries is declared in a Python file. Each query is given a name. Nomad can run migration scripts in 1.20 again and again each time it is executed but ignore any query whose name can be found in \"nomad\" table. Therefore, database migration can be done in an incremental way.\r\n\r\nNote: Special queries like CREATE TABLE x, ALTER TABLE x ADD COLUMN m can be named in special way to avoid mistakes. However it is up to developers.\r\n\r\n+ Also it is great if Nomad can assign the database connection to the executable file written in Python so developer can reuse the connection and rollback the whole changes when needed.\r\n\r\nWhat do you think about it?"}}