{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/20436","repository_url":"https://api.github.com/repos/laravel/framework","labels_url":"https://api.github.com/repos/laravel/framework/issues/20436/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/20436/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/20436/events","html_url":"https://github.com/laravel/framework/issues/20436","id":248205322,"number":20436,"title":"Migration rollback silently fails if migration file is missing","user":{"login":"PantherDD","id":11162073,"avatar_url":"https://avatars2.githubusercontent.com/u/11162073?v=4","gravatar_id":"","url":"https://api.github.com/users/PantherDD","html_url":"https://github.com/PantherDD","followers_url":"https://api.github.com/users/PantherDD/followers","following_url":"https://api.github.com/users/PantherDD/following{/other_user}","gists_url":"https://api.github.com/users/PantherDD/gists{/gist_id}","starred_url":"https://api.github.com/users/PantherDD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PantherDD/subscriptions","organizations_url":"https://api.github.com/users/PantherDD/orgs","repos_url":"https://api.github.com/users/PantherDD/repos","events_url":"https://api.github.com/users/PantherDD/events{/privacy}","received_events_url":"https://api.github.com/users/PantherDD/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-08-05T19:44:11Z","updated_at":"2017-08-10T12:11:05Z","closed_at":null,"body":"- Laravel Version: `Laravel Framework 5.4.32`\r\n- PHP Version: `PHP 7.1.3-3+deb.sury.org~xenial+1 (cli) (built: Mar 25 2017 14:00:03) ( NTS )`\r\n- Database Driver & Version: `mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $`\r\n\r\n### Description:\r\n\r\nI ran into an issue after upgrading `laravel/framework` from `v5.4.27` to `v5.4.32`, and it is probably caused by #19922 ([merged into `v5.4.29`](https://github.com/laravel/framework/blob/5.4/CHANGELOG-5.4.md#v5429-2017-07-19)).\r\n\r\nUntil now, if I tried to run `php artisan migrate:rollback`, and a migration file was missing (because I changed my Git branch for example), I got a nice error message telling me that rollback was impossible because of this.\r\n\r\nNow, what happens instead is that:\r\n- the untouched migrations of the batch are rolled back, but\r\n- migrations with missing files are not, and\r\n- I get no error at all.\r\n\r\nEverything looks fine from the output, but some migrations silently fail to run. And further migration rollbacks become impossible at this point, because the highest numbered batch is still in the database, and it never gets rolled back; you get stuck, without an explanation.\r\n\r\nWe should, at the very least, report the skipped migrations (in red?) to the user at the end of the command. Even better would be to also add a flag for users to enable this skipping behavior (disabled by default).\r\n\r\n### Steps To Reproduce:\r\n\r\n1. Create a few migrations and run `php artisan migrate` 🡺 `batch #1`.\r\n2. Create a few more migrations and run `php artisan migrate` 🡺 `batch #2`.\r\n3. Delete one of the migration files that were used in `batch #2`.\r\n4. `php artisan migrate:rollback` 🡺 No error, even though the migration whose file was deleted:\r\n    - wasn't rolled back, and\r\n    - its entry is still in the `migrations` table.\r\n5. To see that you're stuck at this point, run `php artisan migrate:rollback` again a number of times.\r\n"},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/321533543","html_url":"https://github.com/laravel/framework/issues/20436#issuecomment-321533543","issue_url":"https://api.github.com/repos/laravel/framework/issues/20436","id":321533543,"user":{"login":"PantherDD","id":11162073,"avatar_url":"https://avatars2.githubusercontent.com/u/11162073?v=4","gravatar_id":"","url":"https://api.github.com/users/PantherDD","html_url":"https://github.com/PantherDD","followers_url":"https://api.github.com/users/PantherDD/followers","following_url":"https://api.github.com/users/PantherDD/following{/other_user}","gists_url":"https://api.github.com/users/PantherDD/gists{/gist_id}","starred_url":"https://api.github.com/users/PantherDD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PantherDD/subscriptions","organizations_url":"https://api.github.com/users/PantherDD/orgs","repos_url":"https://api.github.com/users/PantherDD/repos","events_url":"https://api.github.com/users/PantherDD/events{/privacy}","received_events_url":"https://api.github.com/users/PantherDD/received_events","type":"User","site_admin":false},"created_at":"2017-08-10T12:11:05Z","updated_at":"2017-08-10T12:11:05Z","body":"This, in its current form, is pretty much \"error hiding\" (or \"exception swallowing\"); an anti-pattern.\r\nhttps://en.wikipedia.org/wiki/Error_hiding\r\n\r\nIf I issue a command to roll back the last batch, that last batch contained 3 migrations, and one of them isn't be rolled back, then the command has failed. First, I need to be told that it failed; second, I need to be told \"why\". It's like ordering a 3-course meal at a restaurant and then (silently) not getting the main course. Not a good experience."}}
{"actor":{"display_login":"PantherDD"}}