-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
php artisan migrate --pretend not working on ChangeColumn #36629
Comments
I could reproduce this, and I believe it's an issue regardless of the database or php version ( and probably other laravel versions). I was able to address the issue by changing
to
All tests still pass, and I'd do a pull request, but I'm not confident enough in my ability to ensure this doesn't break fundamental functionality. Edit: The issue occurs because the schema passes the change column request to the required |
Hmm this is a tricky one. I think it's unfeasible that the pretend flag will ever work with column changes for the reasons @sonja-turo stated above. |
To add to this, yes, it's probably not feasible, because pretend does work if the table and column are already physically in the database. To confirm this:
The exception will not appear because Doctrine has done physical table discovery of a previously created schema, and can find the fields it expects to see. I think it comes down to the use case of |
Well, perhaps it's not feasible to display the query that will be done, but i think in such scenario, this exception should be catch and a simple message "query string not available" should be displayed. It should not interrupt the migration pretending process and just go on with the next one. And for the state A / state B thing, i was in that scenario, i was migrating from version N to version N+1, which contains à lot of migrations, because a lot of thing happens during the development process between releases. I usually use pretend to see if everything seems good to me, it's harder to spot issues on a migrated db than in pretended query logs. |
Reviewed this again, and now think @lk77 is right, and my assumptions about In other words, what's the case for NOT building the alter statements into the grammar? |
Because we don't want to maintain that code ourselves. DBAL already handles that for us. |
Does this mean a ticket on the DBAL repository should be opened? |
No i don't think so, there is nothing they can do, currently, pretend does not seems to be fixable. For this issue to be fixable, a major rework of the way change/rename columns are handled is needed, a temporary fix would be to catch that exception and display a message to the user, which will allow the pretending process to continue. the query string will be missing for that particular migration, but it's better than an unhandled exception i think. |
Hey al. I sent a PR where I implemented the suggestion to display a warning message. I also think that solving the underlying issues would be hard to do. |
Description:
When doing
php artisan migrate --pretend
i have an exception :using
->change()
does not seems to workSteps To Reproduce:
1 / add a column with a migration
2 / change that column in another migration
3 / see that second migration fail when running pretend
thanks.
The text was updated successfully, but these errors were encountered: