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
SQLite returns timestamp for date fields defined by t.datetime
in a populated entity
#5550
Comments
Where do you read it's "recommended"? I would actually discourage it, since it means the hydration will use the custom type convertor methods, resulting in a (small) perf hit. I would love to find a way around this, but some types need the convertors (and users can extend the type, in which case we also need to respect it). edit: just to be clear, I would love to find a way around the perf issue, what you are reporting here is something we will surely find a fix for regardless of that |
By "recommended" I mean that I understood that types may be defined by
So that's why I'm using If you discourage it, what is the proper way of defining it? Other ways ( |
Any of those. When you use the types map, you use the custom type, which in fact does nothing (but the hydration functions still need to call its convertor methods, as it does not know they are in fact just identity functions). If you are not using a union type (as in Again, this is rather something to improve than to document, I don't want people to think about this. |
Thank you! |
Describe the bug
This occurs only with
@mikro-orm/sqlite
driver,@mikro-orm/postgresql
works as expected.Tested on v6.2.5, v6.2.0, v6.1.0, v6.0.0
Might be related to #4362
Reproduction
@Property({ type: t.datetime })
or@Property({ type: DateTimeType })
(recommended in docs)Full reproduction case available here: https://stackblitz.com/edit/mikro-orm-getting-started-guide-cp-1-rcgxpm (test with
npm start
)Here is short summary:
In above example:
tdatetime
which is number:What driver are you using?
@mikro-orm/sqlite
MikroORM version
6.2.5
Node.js version
Node 18.18.2, Typescript 5.2.2
Operating system
Windows/ Stackblitz
Validations
The text was updated successfully, but these errors were encountered: