add LIMIT 1 to our updates, out of healthy fear

This is just me thinking about what could go wrong in the modeling rollout,

this at least makes it so that, if something breaks, it will break small
This commit is contained in:
Emi Matchu 2020-09-25 05:15:58 -07:00
parent cc5a8a6fab
commit 94f6363251
2 changed files with 7 additions and 7 deletions

View file

@ -1035,7 +1035,7 @@ Array [
], ],
], ],
Array [ Array [
"UPDATE items SET rarity_index = ?, thumbnail_url = ?, updated_at = ?, zones_restrict = ? WHERE id = ?;", "UPDATE items SET rarity_index = ?, thumbnail_url = ?, updated_at = ?, zones_restrict = ? WHERE id = ? LIMIT 1;",
Array [ Array [
500, 500,
"http://images.neopets.com/items/mall_staff_jewelled.gif", "http://images.neopets.com/items/mall_staff_jewelled.gif",
@ -1045,7 +1045,7 @@ Array [
], ],
], ],
Array [ Array [
"UPDATE item_translations SET description = ?, name = ?, updated_at = ? WHERE item_id = ? AND locale = \\"en\\";", "UPDATE item_translations SET description = ?, name = ?, updated_at = ? WHERE item_id = ? AND locale = \\"en\\" LIMIT 1;",
Array [ Array [
"This jewelled staff shines with a magical light.", "This jewelled staff shines with a magical light.",
"Jewelled Staff", "Jewelled Staff",
@ -1466,7 +1466,7 @@ Array [
], ],
], ],
Array [ Array [
"UPDATE swf_assets SET body_id = ? WHERE type = ? AND remote_id = ?;", "UPDATE swf_assets SET body_id = ? WHERE type = ? AND remote_id = ? LIMIT 1;",
Array [ Array [
"0", "0",
"object", "object",

View file

@ -488,10 +488,10 @@ async function syncToDb(
const qs = columnNames.map((c) => `${c} = ?`).join(", "); const qs = columnNames.map((c) => `${c} = ?`).join(", ");
const [conditionQs, ...conditionValues] = buildUpdateCondition(incomingRow); const [conditionQs, ...conditionValues] = buildUpdateCondition(incomingRow);
updatePromises.push( updatePromises.push(
db.execute(`UPDATE ${tableName} SET ${qs} WHERE ${conditionQs};`, [ db.execute(
...rowValues, `UPDATE ${tableName} SET ${qs} WHERE ${conditionQs} LIMIT 1;`,
...conditionValues, [...rowValues, ...conditionValues]
]) )
); );
} }
await Promise.all(updatePromises); await Promise.all(updatePromises);