mirror of
https://github.com/strapi/strapi.git
synced 2025-12-29 08:04:51 +00:00
Merge branch 'main' into fix/date-time-picker-crash-delete-date-cleaned
This commit is contained in:
commit
5b60ac513d
@ -22,12 +22,6 @@ class PostgresDialect extends Dialect {
|
||||
'text',
|
||||
(v) => v
|
||||
);
|
||||
// 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',
|
||||
|
||||
@ -8,7 +8,12 @@ class JSONField extends Field {
|
||||
}
|
||||
|
||||
fromDB(value) {
|
||||
if (typeof value === 'string') return JSON.parse(value);
|
||||
try {
|
||||
if (typeof value === 'string') return JSON.parse(value);
|
||||
} catch (error) {
|
||||
// Just return the value if it's not a valid JSON string
|
||||
return value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user