Fix JSON field for postgres when the value is a simple string

This commit is contained in:
Pierre Noël 2023-02-08 18:09:54 +01:00
parent 17a7845e3d
commit 52bcdad90b

View File

@ -16,11 +16,18 @@ class PostgresDialect extends Dialect {
}
async initialize() {
// Don't cast DATE string to Date()
this.db.connection.client.driver.types.setTypeParser(
this.db.connection.client.driver.types.builtins.DATE,
'text',
(v) => v
); // Don't cast DATE string to Date()
);
// Don't parse JSONB automatically
this.db.connection.client.driver.types.setTypeParser(
this.db.connection.client.driver.types.builtins.JSONB,
'text',
(v) => v
);
this.db.connection.client.driver.types.setTypeParser(
this.db.connection.client.driver.types.builtins.NUMERIC,
'text',