mirror of
https://github.com/strapi/strapi.git
synced 2025-09-27 09:25:46 +00:00
Fix JSON field for postgres when the value is a simple string
This commit is contained in:
parent
17a7845e3d
commit
52bcdad90b
@ -16,11 +16,18 @@ class PostgresDialect extends Dialect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async initialize() {
|
async initialize() {
|
||||||
|
// Don't cast DATE string to Date()
|
||||||
this.db.connection.client.driver.types.setTypeParser(
|
this.db.connection.client.driver.types.setTypeParser(
|
||||||
this.db.connection.client.driver.types.builtins.DATE,
|
this.db.connection.client.driver.types.builtins.DATE,
|
||||||
'text',
|
'text',
|
||||||
(v) => v
|
(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.setTypeParser(
|
||||||
this.db.connection.client.driver.types.builtins.NUMERIC,
|
this.db.connection.client.driver.types.builtins.NUMERIC,
|
||||||
'text',
|
'text',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user