Skip to content

Commit 4d86312

Browse files
committed
internal/relui: default to postgres as maintdb
In non-development environments, the default will be a database that is the same as the username, which is not likely to exist. For golang/go#47401 Change-Id: I2e4664f7917d1a63417cc1a19f800a043dff9d43 Reviewed-on: https://go-review.googlesource.com/c/build/+/363976 Trust: Alexander Rakoczy <[email protected]> Run-TryBot: Alexander Rakoczy <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]> TryBot-Result: Go Bot <[email protected]>
1 parent 9076251 commit 4d86312

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

internal/relui/store.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ func MigrateDB(conn string, downUp bool) error {
8989
// with the name cfg.User will be used.
9090
func ConnectMaintenanceDB(ctx context.Context, cfg *pgx.ConnConfig, maintDB string) (*pgx.Conn, error) {
9191
cfg = cfg.Copy()
92+
if maintDB == "" {
93+
maintDB = "postgres"
94+
}
9295
cfg.Database = maintDB
9396
return pgx.ConnectConfig(ctx, cfg)
9497
}

0 commit comments

Comments
 (0)