{"action":"closed","issue":{"url":"https://api.github.com/repos/db-migrate/node-db-migrate/issues/281","repository_url":"https://api.github.com/repos/db-migrate/node-db-migrate","labels_url":"https://api.github.com/repos/db-migrate/node-db-migrate/issues/281/labels{/name}","comments_url":"https://api.github.com/repos/db-migrate/node-db-migrate/issues/281/comments","events_url":"https://api.github.com/repos/db-migrate/node-db-migrate/issues/281/events","html_url":"https://github.com/db-migrate/node-db-migrate/issues/281","id":92685303,"number":281,"title":"Feature: down all migrations one command and allow use db-migrate as module","user":{"login":"rkmax","id":395707,"avatar_url":"https://avatars.githubusercontent.com/u/395707?v=3","gravatar_id":"","url":"https://api.github.com/users/rkmax","html_url":"https://github.com/rkmax","followers_url":"https://api.github.com/users/rkmax/followers","following_url":"https://api.github.com/users/rkmax/following{/other_user}","gists_url":"https://api.github.com/users/rkmax/gists{/gist_id}","starred_url":"https://api.github.com/users/rkmax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkmax/subscriptions","organizations_url":"https://api.github.com/users/rkmax/orgs","repos_url":"https://api.github.com/users/rkmax/repos","events_url":"https://api.github.com/users/rkmax/events{/privacy}","received_events_url":"https://api.github.com/users/rkmax/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/db-migrate/node-db-migrate/labels/feature","name":"feature","color":"009800"},{"url":"https://api.github.com/repos/db-migrate/node-db-migrate/labels/question","name":"question","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":{"login":"wzrdtales","id":1786821,"avatar_url":"https://avatars.githubusercontent.com/u/1786821?v=3","gravatar_id":"","url":"https://api.github.com/users/wzrdtales","html_url":"https://github.com/wzrdtales","followers_url":"https://api.github.com/users/wzrdtales/followers","following_url":"https://api.github.com/users/wzrdtales/following{/other_user}","gists_url":"https://api.github.com/users/wzrdtales/gists{/gist_id}","starred_url":"https://api.github.com/users/wzrdtales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wzrdtales/subscriptions","organizations_url":"https://api.github.com/users/wzrdtales/orgs","repos_url":"https://api.github.com/users/wzrdtales/repos","events_url":"https://api.github.com/users/wzrdtales/events{/privacy}","received_events_url":"https://api.github.com/users/wzrdtales/received_events","type":"User","site_admin":false},"assignees":[{"login":"wzrdtales","id":1786821,"avatar_url":"https://avatars.githubusercontent.com/u/1786821?v=3","gravatar_id":"","url":"https://api.github.com/users/wzrdtales","html_url":"https://github.com/wzrdtales","followers_url":"https://api.github.com/users/wzrdtales/followers","following_url":"https://api.github.com/users/wzrdtales/following{/other_user}","gists_url":"https://api.github.com/users/wzrdtales/gists{/gist_id}","starred_url":"https://api.github.com/users/wzrdtales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wzrdtales/subscriptions","organizations_url":"https://api.github.com/users/wzrdtales/orgs","repos_url":"https://api.github.com/users/wzrdtales/repos","events_url":"https://api.github.com/users/wzrdtales/events{/privacy}","received_events_url":"https://api.github.com/users/wzrdtales/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/db-migrate/node-db-migrate/milestones/2","html_url":"https://github.com/db-migrate/node-db-migrate/milestones/v0.10.0","labels_url":"https://api.github.com/repos/db-migrate/node-db-migrate/milestones/2/labels","id":972639,"number":2,"title":"v0.10.0","description":"","creator":{"login":"wzrdtales","id":1786821,"avatar_url":"https://avatars.githubusercontent.com/u/1786821?v=3","gravatar_id":"","url":"https://api.github.com/users/wzrdtales","html_url":"https://github.com/wzrdtales","followers_url":"https://api.github.com/users/wzrdtales/followers","following_url":"https://api.github.com/users/wzrdtales/following{/other_user}","gists_url":"https://api.github.com/users/wzrdtales/gists{/gist_id}","starred_url":"https://api.github.com/users/wzrdtales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wzrdtales/subscriptions","organizations_url":"https://api.github.com/users/wzrdtales/orgs","repos_url":"https://api.github.com/users/wzrdtales/repos","events_url":"https://api.github.com/users/wzrdtales/events{/privacy}","received_events_url":"https://api.github.com/users/wzrdtales/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":47,"state":"open","created_at":"2015-02-09T21:50:39Z","updated_at":"2016-09-30T06:49:21Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-07-02T17:00:55Z","updated_at":"2016-09-30T06:49:21Z","closed_at":"2016-09-30T06:49:21Z","body":"I have many migrations that represents all my database, when I run tests I use the migrations to recreate a test database in a known state usualy I pass something like\r\n\r\n```js\r\nvar exec = require('child_process').exec;\r\nvar Promise = require('bluebird');\r\n\r\nfunction execAsync(cmd) {\r\n  return new Promise(function(resolve, reject) {\r\n    exec(cmd, function(err, stdout, stderr) {\r\n      if (err) { reject(err); } else { resolve({stdout: stdout, stderr: stderr}); }\r\n    });\r\n  }\r\n}\r\nmodule.exports = {\r\n  down: function() {\r\n    return execAsync('db-migrate down -c 100');\r\n  },\r\n  up: function(down) {\r\n     return Promise.resolve()\r\n       .then(function() {\r\n         if (down) { return this.down() }  else {\r\n           return Promise.resolve();\r\n         }\r\n       }.bind(this))\r\n       .then(function() {\r\n          return execAsync('db-migrate up');\r\n       });\r\n  }\r\n}\r\n```\r\n\r\nwould be great if I can pass something like `--all` to the down command and if I can use db-migrate as module\r\n\r\n```js\r\n  var migrate = require('db-migrate');\r\n\r\n  ...\r\n  return migrate.down({all: true}).then(function() { return migrate.up(); });\r\n```\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/23545036-feature-down-all-migrations-one-command-and-allow-use-db-migrate-as-module?utm_campaign=plugin&utm_content=tracker%2F73887&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F73887&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"}}
{"actor":{"display_login":"wzrdtales"}}