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
()
| 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 |
| 150 | func (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 |
no outgoing calls