“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 in order of 1234.
FML.
AlphaOmega@lemmy.world 1 year ago
This is a good lesson to learn the hard way. From now on, my guess is you will have dozens of backups.
marcos@lemmy.world 1 year ago
And a development environment. And not touch production without running the exact code at least once and being well slept.
ReluctantMuskrat@lemmy.world 1 year ago
And always use a transaction so you’re required to commit to make it permanent. See an unexpected result? Rollback.
sim642@lemm.ee 1 year ago
Transactions aren’t backups. You can just as easily commit before fully realizing it. Backups, backups, backups.
Tylerdurdon@lemmy.world 1 year ago
This is the way