-
-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when updating an entity with a custom type #5176
Comments
You might need to extend the Try this: export class GeoJSONPolygonType extends JsonType {
convertToJSValueSQL(key: string) {
return `ST_AsGeoJSON(${key},15)`;
}
convertToDatabaseValueSQL(key: string) {
return `ST_GeomFromGeoJSON(${key})`;
}
getColumnType(): string {
return 'GEOGRAPHY(POLYGON,4326)';
}
} |
I used this type and added new tests to the repository - https://github.com/skaltus/reproduction/blob/master/src/example.test.ts Native update, create, fetch entity work fine. Btw, I forgot to mention that the error appeared after updating to 6.0.5, in 5.9.7 everything worked |
The problem is not that it remains unparsed, the update works correctly, but it has edit: to be precise, the problem is support for |
The fix is not very complete, but I wasn't able to come up with any examples on how to break things the same way for insert+returning or for the insert/update many methods, so leaving that for future if someone actually comes up with a breaking repro. |
Describe the bug
Error when updating an entity with a custom type:
Custom type:
Entity:
Entity update code:
Update query:
Error:
I'm not sure, but it looks like convertToJSValueSQL is not used in the update query or update query should not return polygon
Reproduction
https://github.com/skaltus/reproduction
What driver are you using?
@mikro-orm/postgresql
MikroORM version
6.0.5
Node.js version
18
Operating system
Ubuntu 20.04
Validations
The text was updated successfully, but these errors were encountered: