File tree Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,15 @@ 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
+
16
+ ## Deprecated the "default_dbname" parameter of the wrapper ` Connection ` .
17
+
18
+ The "default_dbname" parameter of the wrapper ` Connection ` has been deprecated. Use "dbname" instead.
19
+
11
20
## Deprecated the "platform" parameter of the wrapper ` Connection ` .
12
21
13
22
The "platform" parameter of the wrapper ` Connection ` has been deprecated. Use a driver middleware that would instantiate
Original file line number Diff line number Diff line change @@ -203,8 +203,6 @@ pdo_pgsql
203
203
- ``dbname `` (string): Name of the database/schema to connect to.
204
204
- ``charset `` (string): The charset used when connecting to the
205
205
database.
206
- - ``default_dbname `` (string): Override the default database (postgres)
207
- to connect to.
208
206
- ``sslmode `` (string): Determines whether or with what priority
209
207
a SSL TCP/IP connection will be negotiated with the server.
210
208
See the list of available modes:
Original file line number Diff line number Diff line change 5
5
use Doctrine \DBAL \Driver \AbstractPostgreSQLDriver ;
6
6
use Doctrine \DBAL \Driver \PDO \Connection ;
7
7
use Doctrine \DBAL \Driver \PDO \Exception ;
8
+ use Doctrine \Deprecations \Deprecation ;
8
9
use PDO ;
9
10
use PDOException ;
10
11
@@ -73,11 +74,25 @@ private function constructPdoDsn(array $params): string
73
74
if (isset ($ params ['dbname ' ])) {
74
75
$ dsn .= 'dbname= ' . $ params ['dbname ' ] . '; ' ;
75
76
} elseif (isset ($ params ['default_dbname ' ])) {
77
+ Deprecation::trigger (
78
+ 'doctrine/dbal ' ,
79
+ 'https://github.com/doctrine/dbal/pull/5705 ' ,
80
+ 'The "default_dbname" connection parameter is deprecated. Use "dbname" instead. ' ,
81
+ );
82
+
76
83
$ dsn .= 'dbname= ' . $ params ['default_dbname ' ] . '; ' ;
77
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
+
78
95
// Used for temporary connections to allow operations like dropping the database currently connected to.
79
- // Connecting without an explicit database does not work, therefore "postgres" database is used
80
- // as it is mostly present in every server setup.
81
96
$ dsn .= 'dbname=postgres; ' ;
82
97
}
83
98
You can’t perform that action at this time.
0 commit comments