{"action":"created","issue":{"url":"https://api.github.com/repos/tj/node-migrate/issues/89","repository_url":"https://api.github.com/repos/tj/node-migrate","labels_url":"https://api.github.com/repos/tj/node-migrate/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/tj/node-migrate/issues/89/comments","events_url":"https://api.github.com/repos/tj/node-migrate/issues/89/events","html_url":"https://github.com/tj/node-migrate/issues/89","id":273826421,"number":89,"title":"Removing old migrations causes confusion","user":{"login":"qqilihq","id":2172260,"avatar_url":"https://avatars0.githubusercontent.com/u/2172260?v=4","gravatar_id":"","url":"https://api.github.com/users/qqilihq","html_url":"https://github.com/qqilihq","followers_url":"https://api.github.com/users/qqilihq/followers","following_url":"https://api.github.com/users/qqilihq/following{/other_user}","gists_url":"https://api.github.com/users/qqilihq/gists{/gist_id}","starred_url":"https://api.github.com/users/qqilihq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qqilihq/subscriptions","organizations_url":"https://api.github.com/users/qqilihq/orgs","repos_url":"https://api.github.com/users/qqilihq/repos","events_url":"https://api.github.com/users/qqilihq/events{/privacy}","received_events_url":"https://api.github.com/users/qqilihq/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-11-14T15:09:58Z","updated_at":"2017-11-15T18:31:22Z","closed_at":null,"author_association":"NONE","body":"Removing old migration files seems to bring node-migrate out of sync. Example:\r\n\r\n```\r\n$ migrate create one\r\n$ migrate create two\r\n$ migrate create three\r\n$ ls migrations\r\n1510670884434-one.js   1510670888566-two.js   1510670890981-three.js\r\n$ migrate\r\n  up : 1510670884434-one.js\r\n  up : 1510670888566-two.js\r\n  up : 1510670890981-three.js\r\n  migration : complete\r\n```\r\n\r\nLater we add a new migration and remove old ones, which we do not want to support any longer:\r\n\r\n```\r\n$ migrate create four\r\n$ ls migrations\r\n1510670884434-one.js   1510670888566-two.js   1510670890981-three.js 1510670980407-four.js\r\n$ rm migrations/1510670884434-one.js migrations/1510670888566-two.js\r\n$ ls migrations\r\n1510670890981-three.js 1510670980407-four.js\r\n$ migrate\r\n  migration : complete\r\n```\r\n\r\nNotice that `1510670980407-four.js` will **not get executed** now.\r\n\r\nIn our case, we would like to remove old migration scripts, because their logic wouldn't work any longer anyways due to changed dependencies, etc.\r\n\r\nThis happens with 0.2.4 and the version from the `next` tag as well. Is this behavior intentional or could be handled more gracefully in the future?"},"comment":{"url":"https://api.github.com/repos/tj/node-migrate/issues/comments/344685058","html_url":"https://github.com/tj/node-migrate/issues/89#issuecomment-344685058","issue_url":"https://api.github.com/repos/tj/node-migrate/issues/89","id":344685058,"user":{"login":"qqilihq","id":2172260,"avatar_url":"https://avatars0.githubusercontent.com/u/2172260?v=4","gravatar_id":"","url":"https://api.github.com/users/qqilihq","html_url":"https://github.com/qqilihq","followers_url":"https://api.github.com/users/qqilihq/followers","following_url":"https://api.github.com/users/qqilihq/following{/other_user}","gists_url":"https://api.github.com/users/qqilihq/gists{/gist_id}","starred_url":"https://api.github.com/users/qqilihq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qqilihq/subscriptions","organizations_url":"https://api.github.com/users/qqilihq/orgs","repos_url":"https://api.github.com/users/qqilihq/repos","events_url":"https://api.github.com/users/qqilihq/events{/privacy}","received_events_url":"https://api.github.com/users/qqilihq/received_events","type":"User","site_admin":false},"created_at":"2017-11-15T18:31:22Z","updated_at":"2017-11-15T18:31:22Z","author_association":"NONE","body":"Hi @wesleytodd! Thanks for the detailed feedback.\r\n\r\nI'm currently a little stuffed with work, but I'll double check wether the given case covers my issue, many thanks! I'll get back about that asap.\r\n\r\nI understand that my given scenario is quite “special”. Let me highlight our use case anyways: We’ve built a product in a quite “agile” manner. Means, at the beginning we did many DB migrations and never cared about covering the ”back” path (ie. our `down` implementation just throws an `Error` 😊 ). That’s probably a terrible abuse of the initial idea behind `node-migrate`, but the tool worked quite well for us and we wouldn’t want to miss it.\r\n\r\nThat being said, we’ve now reached a point where the child has become an adult, and our migrations will become more sparse (and now also cover potential back migrations). That’s why I thought a “clean cut” would be nice.\r\n\r\nThat being said, I've just realized that we can simply remove all old the old migration steps from our repo, delete the state file and start with over. Problem solved, simple.\r\n\r\nStill, at the end, I think either logging a warning or even throwing an error in the above highlighted case would be best -- it avoids any misunderstandings concerning the usage of `node-migrate`.\r\n\r\nLooking forward to v1.0. Many thanks for your efforts!"}}
{"actor":{"display_login":"qqilihq"}}