Last Updated: 2022-12-01
In raw SQL - instead of through my ORM - I updated all rows in the
table that had empty
company_name columns to have their
company_name set to
their first and last name. Later on, this turned out to be a bad idea and I
wished to revert it. I was hoping to identify the records by their
field but this was not possible because the SQL update I wrote did not set the
updated_at field, instead leaving it at its original value. This removed my
ability to easily undo my mistake.
There could have been two ways to deal with this.
UPDATE advisors SET updated_at = NOW(), company_name = "..." WHERE company_name IS NULL;
When doing a big change in the production database as opposed to through an ORM,
don't forget to bump the
updated_at field in raw SQL. Otherwise it is more
dificult to identify those changes.