Skip to content

Commit f0d0dce

Browse files
authored
Use postgres as maintenance db unless maintaining postgres itself (#1339)
Fixes #1283.
1 parent 34db44b commit f0d0dce

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sqlx-core/src/postgres/migrate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ fn parse_for_maintenance(uri: &str) -> Result<(PgConnectOptions, String), Error>
2424
.to_owned();
2525

2626
// switch us to the maintenance database
27-
// use `postgres` _unless_ the current user is postgres, in which case, use `template1`
27+
// use `postgres` _unless_ the database is postgres, in which case, use `template1`
2828
// this matches the behavior of the `createdb` util
29-
options.database = if options.username == "postgres" {
29+
options.database = if database == "postgres" {
3030
Some("template1".into())
3131
} else {
3232
Some("postgres".into())

0 commit comments

Comments
 (0)