Open larsyencken opened 1 month ago
We use a timestamp model for gdocs_posts which includes a few fields, such as:
gdocs_posts
createdAt
updatedAt
publishedAt
By design, we expect updatedAt to be NULL if no updates have happened post create. This is how it is defined in MySQL.
NULL
A number of rows in gdocs_posts (e.g. with slug = 'fiona-spooner') have the Unix epoch (1970-01-01) set instead of NULL.
slug = 'fiona-spooner'
1970-01-01
It only seems to have been a problem for:
After checking the schema, this must be happening on the JS side rather than the MySQL side. We can fix the rows, but it would be nice to fix the JS model to avoid this scenario.
It's probably this line here?: https://github.com/owid/owid-grapher/blob/2b79d4baf8ebb3a01f5e0b83f05f1cdcc4317c8f/db/model/Gdoc/GdocFactory.ts#L66
I quickly checked, and new Date(null) is indeed 1970-01-01.
new Date(null)
Context
We use a timestamp model for
gdocs_posts
which includes a few fields, such as:createdAt
updatedAt
publishedAt
By design, we expect
updatedAt
to beNULL
if no updates have happened post create. This is how it is defined in MySQL.Problem
A number of rows in
gdocs_posts
(e.g. withslug = 'fiona-spooner'
) have the Unix epoch (1970-01-01
) set instead ofNULL
.Impact
It only seems to have been a problem for:
Technical notes
After checking the schema, this must be happening on the JS side rather than the MySQL side. We can fix the rows, but it would be nice to fix the JS model to avoid this scenario.