• SzethFriendOfNimi@lemmy.world
    link
    fedilink
    arrow-up
    10
    ·
    edit-2
    11 months ago

    Transactions are your friend here

    Begin transaction;

    Then

    Your sql here

    Double/triple check the messages/console for results. Look good?

    Commit;

    Worried?

    Rollback;

    Just be sure to mind your transaction logs for long running queries and by all things holy be sure you’re not doing this to a live db with a ton of transactions since you’re basically pausing any updates until the commit or rollback on the affected tables

    • Jo Miran@lemmy.ml
      link
      fedilink
      arrow-up
      5
      ·
      11 months ago

      Me: “Ok. What’s the big deal.”

      Also me: “Less than a million affected. That’s nothing.”

      Still me: “Rule 1: Never let pesky details get in the way of a funny meme.”

      Ultimately me: 😱😂 “That guy is in for a rough Monday!”