Replies: 2 comments 2 replies
-
This is not v6 specific, But it could mean a lot of duplication, will need to take a closer look, might not be worth it. |
Beta Was this translation helpful? Give feedback.
-
I undestand it's a lot of work and there are other types to consider too, such as |
Beta Was this translation helpful? Give feedback.
-
I'm developing a Postgresql application and I have some doubts about exported types.
I was upgrading my code to V6 and reading the migration guide in this section:
https://mikro-orm.io/docs/upgrading-v5-to-v6#all-drivers-now-re-export-the-mikro-ormcore-package
I was happy to directly have a Sql EntityManager as I'm using Postgres and avoid the casting hell when I needed to create, for example, a QueryBuilder.
The problem I found is the mismatch of driver types, even importing from Postgresql implementation (I imagine is a direct forward from the core):
In this example the EventArgs, even being imported from postgresql do not forward the "correct" entity manager type, so I have two solutions as far as I can undestand:
1 - Cast the entity manager to sql entity manager when calling
this.checkPhoneNumber(args.entity, args.em as SqlEntityManager)
2 - Use the core EntityManager, but I have to cast to SqlEntityManager again to create the query builder and have imports from the two parts: core and postgres.
I don't know if I'm missing something, but it would be good all the subtypes exported from the specific database implementation are already casted to Postgresql driver to be fully compatible.
Beta Was this translation helpful? Give feedback.
All reactions