MCPcopy Index your code
hub / github.com/ddev/ddev / GetExistingDBType

Method GetExistingDBType

pkg/ddevapp/db.go:17–28  ·  view source on GitHub ↗

GetExistingDBType returns type/version like mariadb:10.11 or postgres:13 or "" if no existing volume This has to make a Docker container run so is fairly costly.

()

Source from the content-addressed store, hash-verified

15// GetExistingDBType returns type/version like mariadb:10.11 or postgres:13 or "" if no existing volume
16// This has to make a Docker container run so is fairly costly.
17func (app *DdevApp) GetExistingDBType() (string, error) {
18 dbVersionInfo, err := app.getDBVersionFromVolume()
19 if err != nil {
20 return "", err
21 }
22
23 if dbVersionInfo == "" {
24 return "", nil
25 }
26
27 return GetDBTypeVersionFromString(dbVersionInfo), nil
28}
29
30// getDBVersionFromVolume inspects the database volume to determine version info
31// Returns the raw version string found in the volume, or empty string if none found

Calls 2

Tested by 3

TestDdevAllDatabasesFunction · 0.76