{"action":"created","issue":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/7902","repository_url":"https://api.github.com/repos/sequelize/sequelize","labels_url":"https://api.github.com/repos/sequelize/sequelize/issues/7902/labels{/name}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/7902/comments","events_url":"https://api.github.com/repos/sequelize/sequelize/issues/7902/events","html_url":"https://github.com/sequelize/sequelize/issues/7902","id":241197672,"number":7902,"title":"Migrations should happen in a transaction","user":{"login":"rjmunro","id":108641,"avatar_url":"https://avatars0.githubusercontent.com/u/108641?v=4","gravatar_id":"","url":"https://api.github.com/users/rjmunro","html_url":"https://github.com/rjmunro","followers_url":"https://api.github.com/users/rjmunro/followers","following_url":"https://api.github.com/users/rjmunro/following{/other_user}","gists_url":"https://api.github.com/users/rjmunro/gists{/gist_id}","starred_url":"https://api.github.com/users/rjmunro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjmunro/subscriptions","organizations_url":"https://api.github.com/users/rjmunro/orgs","repos_url":"https://api.github.com/users/rjmunro/repos","events_url":"https://api.github.com/users/rjmunro/events{/privacy}","received_events_url":"https://api.github.com/users/rjmunro/received_events","type":"User","site_admin":false},"labels":[{"id":636646701,"url":"https://api.github.com/repos/sequelize/sequelize/labels/stale","name":"stale","color":"aaaaaa","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-07T08:45:22Z","updated_at":"2017-09-05T08:52:02Z","closed_at":null,"author_association":"NONE","body":"This is intentionally a reopening of #1882 which was closed automatically by a bot. I think it's a fundamental feature for a migration engine.\r\n\r\n## What you are doing?\r\n\r\nThere was a problem applying a migration, due to a issue in the code of the migrations.\r\n\r\n## What do you expect to happen?\r\n\r\nI expect the whole migration to be rolled back.\r\n\r\nNearly all database engines support DDL in transactions. It should be the default way updates are done, unless the user chooses not to.\r\n\r\nEven if the database does not fully support transactions for DDL (MySQL) sometimes migrations can make updates to data e.g. adding records to lookup tables, and it should be the default to roll these back.\r\n\r\n## What is actually happening?\r\n\r\nThe database ends up in an inconsistent state, with half the changes of the migration applied, but not the other half. I can't re-run the migration, I can't easily go back. I have to manually finish the migration and then manually update the meta tables."},"comment":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/comments/327113349","html_url":"https://github.com/sequelize/sequelize/issues/7902#issuecomment-327113349","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/7902","id":327113349,"user":{"login":"stale[bot]","id":26384082,"avatar_url":"https://avatars2.githubusercontent.com/u/26350515?v=4","gravatar_id":"","url":"https://api.github.com/users/stale%5Bbot%5D","html_url":"https://github.com/apps/stale","followers_url":"https://api.github.com/users/stale%5Bbot%5D/followers","following_url":"https://api.github.com/users/stale%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/stale%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/stale%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stale%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/stale%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/stale%5Bbot%5D/repos","events_url":"https://api.github.com/users/stale%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/stale%5Bbot%5D/received_events","type":"Bot","site_admin":false},"created_at":"2017-09-05T08:52:02Z","updated_at":"2017-09-05T08:52:02Z","author_association":"NONE","body":"This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment 🙂\n"}}
{"actor":{"display_login":"stale"}}