🌳 Evergreen thought

2022 Week 33 & 34 in Review

planted on in: Week In Review.
~439 words, about a 3 min read.

"Human beings are born with different capacities. If they are free, they are not equal. And if they are equal, they are not free."
— Aleksandr Solzhenitsyn

I spent the whole of last week (wk33) on holiday in Herne Bay. While I did bring my laptop with me, I didn't make much use of it beyond playing Minecraft for a few hours.

This week at work I have jumped back into working on our growing mono-repo which means more TypeScript and Prisma.js fun. Speaking of Prisma, there was activity on issue #5006: Support 0000-00-00 00:00:00 for MySQL with two people providing similar solutions to the problem of Prisma.js crashing on MySQL zero dates.

The first approach by ChrisM3y is using a preManipulationHook function to set any zero dates to now(). There are three key problems with this approach:

  • The preManipulationHook must be run before each SELECT query on a problematic table adding overhead
  • A zero date value can be considered as unset, setting it to an arbitrary value errases that information
  • The date column can have importance, a zero date for the column booked_in_at can mean the booking has yet to be made, updating that to an arbitrary value will cause undesirable side effects

The second and most recent solution provided by bjih1999 invokes the usage of MySQL generated columns to create a virtual column that is DateTime|null.

This is an eloquent solution to the problem, not ideal but good as a stop-gap measure; however, the problem of having zero date fields largely raises its ugly head in large legacy databases, these tend to have a lot of rows to which any alterations to the schema comes at a cost of locking the table for a period of time - therefore often is the case that schema changes have to go through approval processes and be planned to ensure downtime is either mitigated or constrained.

Joke of the week

"Why didn’t Han Solo enjoy his steak dinner? It was Chewie."

Notable Articles Read

Notable Videos Watched

Cool things from around the internet

Page History

This page was first added to the repository on August 31, 2022 in commit 7da81fec and has since been amended 3 times. View the source on GitHub.

  1. refactor(#304): move files into src folder
  2. chore: prefix slugs for 2022 week in review with year
  3. bugfix: remove accidental heading
  4. feat: publish week 33/34 in review