Fix: DB_CLIENT mapping for PostgreSQL #90
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: DB_CLIENT mapping for PostgreSQL
Problem
When using
databaseEngine: postgresqlin values.yaml, the Helm chart setsDB_CLIENT=postgresqlin the ConfigMap. However, Directus uses Knex.js as its database client, and Knex.js expectspg(notpostgresql) as the client name for PostgreSQL connections.This causes Directus to fail on startup with the following error:
The error is misleading - it's not actually about the database being installed, but rather that Knex.js doesn't recognize
postgresqlas a valid client and the bootstrap process fails.Evidence from Directus Source Code
From api/src/database/index.ts:
Solution
Updated
templates/configmap.yamlto support all common PostgreSQL aliases and map them topg:This maintains backward compatibility and adds flexibility:
mysql→mysql(unchanged)postgresql→pg(fixed, backward compatible)postgres→pg(new alias)pg→pg(new alias)Testing
Tested with
helm template:All PostgreSQL aliases correctly map to
pg. Application starts successfully.Checklist