mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 19:21:50 +00:00
When auto-upgrade intent is signaled, we want the frontend to do the migration instead of migrator. As by default, migrator runs up (unless manually changed to something else or invoked), we check before that command runs whether we should auto-upgrade, and exiting with 0 if yes ## Test plan Tested locally in docker-compose setup
13 lines
302 B
Go
13 lines
302 B
Go
package errors
|
|
|
|
import (
|
|
"github.com/jackc/pgconn"
|
|
)
|
|
|
|
// HasPostgresCode checks whether any of the errors in the chain
|
|
// signify a postgres error with the given error code.
|
|
func HasPostgresCode(err error, code string) bool {
|
|
var pgerr *pgconn.PgError
|
|
return As(err, &pgerr) && pgerr.Code == code
|
|
}
|