File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ awareness about deprecated code.
8
8
9
9
# Upgrade to 3.5
10
10
11
+ ## Deprecated default PostgreSQL connection database.
12
+
13
+ Relying on the DBAL connecting to the "postgres" database by default is deprecated. Unless you want to have the server
14
+ determine the default database for the connection, specify the database name explicitly.
15
+
11
16
## Deprecated the "default_dbname" parameter of the wrapper ` Connection ` .
12
17
13
18
The "default_dbname" parameter of the wrapper ` Connection ` has been deprecated. Use "dbname" instead.
Original file line number Diff line number Diff line change @@ -82,9 +82,17 @@ private function constructPdoDsn(array $params): string
82
82
83
83
$ dsn .= 'dbname= ' . $ params ['default_dbname ' ] . '; ' ;
84
84
} else {
85
+ if (isset ($ params ['user ' ]) && $ params ['user ' ] !== 'postgres ' ) {
86
+ Deprecation::trigger (
87
+ 'doctrine/dbal ' ,
88
+ 'https://github.com/doctrine/dbal/pull/5705 ' ,
89
+ 'Relying on the DBAL connecting to the "postgres" database by default is deprecated. '
90
+ . ' Unless you want to have the server determine the default database for the connection, '
91
+ . ' specify the database name explicitly. ' ,
92
+ );
93
+ }
94
+
85
95
// Used for temporary connections to allow operations like dropping the database currently connected to.
86
- // Connecting without an explicit database does not work, therefore "postgres" database is used
87
- // as it is mostly present in every server setup.
88
96
$ dsn .= 'dbname=postgres; ' ;
89
97
}
90
98
You can’t perform that action at this time.
0 commit comments