mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 17:00:55 +00:00
Merge branch 'fix/windows-import-export' of https://github.com/strapi/strapi into fix/windows-import-export
This commit is contained in:
commit
de8351ffbe
@ -22,12 +22,6 @@ class PostgresDialect extends Dialect {
|
|||||||
'text',
|
'text',
|
||||||
(v) => v
|
(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.setTypeParser(
|
||||||
this.db.connection.client.driver.types.builtins.NUMERIC,
|
this.db.connection.client.driver.types.builtins.NUMERIC,
|
||||||
'text',
|
'text',
|
||||||
|
@ -8,7 +8,12 @@ class JSONField extends Field {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fromDB(value) {
|
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;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user