Skip to content
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

[9.x] Prompt to create MySQL db when migrating #44153

Merged
merged 2 commits into from
Sep 16, 2022

Conversation

timacdonald
Copy link
Member

This PR is the MySQL counterpart to #43867

Screen Shot 2022-09-16 at 4 34 49 pm

# No prompt, just attempts to create the file.
# If it fails the exception is shown.

php artisan migrate --force

# No prompt and the exception is shown.
# This is the same as the current behaviour.

php artisan migrate --force

@jbrooksuk
Copy link
Member

@timacdonald what happens when the user does not have permissions to create additional databases?

if (
$e->getPrevious() instanceof PDOException &&
$e->getPrevious()->getCode() === 1049 &&
$connection->getDriverName() === 'mysql') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you create a MySQLDatabaseDoesNotExistException, instead of this if with three conditions (like SQLiteDatabaseDoesNotExistException on L.140)?

@timacdonald
Copy link
Member Author

If any failure occurs the original exception message would be shown.

@amaelftah
Copy link
Contributor

when i was moving from rails to learn laravel I was missing this suggestion ... thanks so much for adding it ❤️

@taylorotwell taylorotwell merged commit 85ca3fb into laravel:9.x Sep 16, 2022
@khalidedaig
Copy link

It's finally come true, I love that, thanks laravels

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants