MCPcopy Create free account
hub / github.com/Permify/permify / EnsureDBVersion

Function EnsureDBVersion

internal/storage/postgres/utils/common.go:214–224  ·  view source on GitHub ↗

EnsureDBVersion checks the version of the given database connection and returns an error if the version is not supported.

(db *pgxpool.Pool)

Source from the content-addressed store, hash-verified

212// EnsureDBVersion checks the version of the given database connection
213// and returns an error if the version is not supported.
214func EnsureDBVersion(db *pgxpool.Pool) (version string, err error) {
215 err = db.QueryRow(context.Background(), "SHOW server_version_num;").Scan(&version)
216 if err != nil {
217 return version, err
218 }
219 v, err := strconv.Atoi(version)
220 if v < earliestPostgresVersion {
221 err = fmt.Errorf("unsupported postgres version: %s, expected >= %d", version, earliestPostgresVersion)
222 }
223 return version, err
224}

Callers 4

PostgresDBFunction · 0.92
DatabaseFactoryFunction · 0.92
MigrateFunction · 0.92
common_test.goFile · 0.92

Calls 1

ScanMethod · 0.45

Tested by

no test coverage detected