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

Method GetPostgresDataDir

pkg/ddevapp/db.go:150–161  ·  view source on GitHub ↗

GetPostgresDataDir returns the correct PostgreSQL data directory path for the given app version PostgreSQL 18+ changed the mount point from /var/lib/postgresql/data to /var/lib/postgresql

()

Source from the content-addressed store, hash-verified

148// GetPostgresDataDir returns the correct PostgreSQL data directory path for the given app version
149// PostgreSQL 18+ changed the mount point from /var/lib/postgresql/data to /var/lib/postgresql
150func (app *DdevApp) GetPostgresDataDir() string {
151 if app.Database.Type != nodeps.Postgres {
152 return ""
153 }
154 v, _ := strconv.Atoi(app.Database.Version)
155 if v < 18 {
156 return "/var/lib/postgresql/data"
157 }
158 // Postgres 18+ changed the default mount point
159 // See https://github.com/docker-library/postgres/pull/1259
160 return "/var/lib/postgresql"
161}
162
163// GetPostgresDataPath returns the path where PostgreSQL actually stores data files
164// This differs from GetPostgresDataDir for PostgreSQL 18+ where files are in a version-specific subdirectory

Callers 6

TestGetPostgresDataDirFunction · 0.95
RestoreSnapshotMethod · 0.95
DefaultWorkingDirMapMethod · 0.95
RenderComposeYAMLMethod · 0.95
StartMethod · 0.95
getBackupCommandFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestGetPostgresDataDirFunction · 0.76