My team has recently run into <https://github.com/...
# orm-help
s
My team has recently run into https://github.com/prisma/prisma/issues/5006 Is there a place to discuss prisma-engine and possible contributions to the code?
1
n
Hey Steven 👋 Do the workarounds mentioned in the GitHub Issue work for you?
s
We can't "ignore" the field because if it has a real value then we need to show it. What we did was
Copy code
(CASE WHEN daterevised = '0000-00-00' THEN NULL ELSE daterevised END) AS daterevised
which works as a workaround, but it is unsatisfactory overall. Primarily, we can't do this is a Prisma object, only in a custom query. The point of moving to Prisma was to avoid doing custom queries. We also have a large, legacy system that we're progressively rewriting from a monolith to a GraphQL back end supporting a Vue front end. The code that hasn't been migrated yet has to keep working. An analysis to find all the 0000-00-00 will be necessary regardless, but migrating the data away from that format might cause issues in the legacy system that we'd all rather not risk changing.
The CASE works well enough on a one-off basis, but what I'd like to do is have an option to have dates that can not be converted to a proper Prisma date return NULL.
I've been looking at the prisma-engine code and found the spot where that could be done instead of throwing an error. I understand some would rather error than gloss over "bad" data but it's simpler than creating a Prisma object that can represent Zero Dates from MySQL that JavaScript will never be able to represent as a Date.
One of the issues with our database is this:
Copy code
`datestarted` date NOT NULL DEFAULT '0000-00-00',
Yes, I'd like to change that, but again, we start to get into how that would impact the still-running legacy system which will necessarily coexist with our new system for some time.
These zero dates are supported in MySQL 5.7 and 8. To say Prisma supports these native type mappings
Copy code
date	DateTime	✔️	@db.Date
is a little bit ... wrong. https://www.prisma.io/docs/concepts/database-connectors/mysql#native-type-mappings
n
Thank you for clarifying your scenario in detail. I can understand that this situation is not ideal, I’ll highlight this issue to our engineering team so that this could be prioritised.
s
Thank you for the consideration! 🙂 I've spent a little time trying to run the prisma-engine tests with some success. And some failures I think are environmental. I've coded in many languages but Rust is new. I'm not sure yet how to tell if the tests I'm running are covering the section of code I'd like to change, but I'm getting there. I'm also working with my manager to get some time for my team to contribute if we can.
🙌 1