"UPDATE table_name SET w = $1, x = $2, y = $4 WHERE z = $3 RETURNING *",
does not do the same as
"UPDATE table_name SET w= $1, x= $2, y = $3, z = $4 RETURNING *",
It’s 2 am and my mind blanked out the WHERE, and just wanted the numbers neatly in order of 1234.
idiot.
FML.
I learned the hard way about the beauty of backups and the 3, 2, 1 rule. And snapshots are the GOAT.
Even large and (supposedly) sophisticated teams can make this mistake, so dont feel bad. It’s all part of learning and growth. You have learned the lesson in a very real and visceral way - it will stick with you forever.
Example - a very large customer running our product across multiple servers, talking back to a large central (and shared) DB server. DB server shat itself. They called us up to see if we had any logs that could be used to reconstruct our part of their database server, because it turned out they had no backups. Had to say no.