Skip to content

Conversation

@mathiasgrimm
Copy link
Contributor

@mathiasgrimm mathiasgrimm commented Jan 23, 2025

This PR is the MySQL counterpart to #44153
Create missing pgsql database like we do for MySQL(and SQLite) when running migrations

When creating a fresh Laravel install, it will fail
image

|| (
($e->getPrevious()->errorInfo[0] ?? null) == '08006'
&& $connection->getDriverName() == 'pgsql'
&& Str::contains($e->getPrevious()->getMessage(), '"'.$connection->getDatabaseName().'"')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pgsql has no specific code for missing database. https://www.postgresql.org/docs/current/errcodes-appendix.html

image

If we don't check for a string such as the database name which is part of the error, a wrong username or password would also offer the user the option to create a database.

@taylorotwell taylorotwell merged commit 96302bf into 11.x Jan 27, 2025
30 of 31 checks passed
@taylorotwell taylorotwell deleted the feat-create-missing-pgsql-database branch January 27, 2025 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants