There is no proper error message for a missing migration file on disk on rollback
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Bug Report
**Current Behavior**
This issue mainly affects developers but could also apply to released extensions in case the developers mess something up
**Steps to Reproduce**
1. Install an extension with migrations
2. Enable the extension to run the migrations
3. Delete one of the migration files from the `vendor` folder
4. Alternative to 3: create a fake migration entry in the database for this extension
5. Select "uninstall" in the admin or use the `migrate:reset` command to rollback the migrations
6. Error "Migration file should contain an array with up/down." will be shown
**Expected Behavior**
A separate error message should be displayed for missing files.
Additionally it would be nice for the error message to contain the name of the file causing the issue, for both types of errors. Right now it's difficult to find which file is causing the issue. I didn't manage to see it with `-vvv` but we can see the start of the migration name in the backtrace in the log file, but it will be truncated if it's long so it might not help.
**Environment**
- Flarum version: beta13
```
Output of "php flarum info", run this in terminal in your Flarum directory.
```
**Possible Solution**
I suggest adding a `throw` in `Migrator::resolve()` when the file doesn't exist instead of ignoring it and inevitably resulting in the array error.
https://github.com/flarum/core/blob/d492579638fb52dafbfe65f1f36a95eb6047f7f3/src/Database/Migrator.php#L236-L243
**Additional Context**
Related https://discuss.flarum.org/d/24453-help-with-migrations-part-2/4
Contributor guide
Assessment
This issue has not been assessed yet.