Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How to not fuck up your day

How to not fuck up your day

Have you ever done something so incredibly stupid that you questioned all your life choices? I did, so you don’t have to. Let me tell you a story of why it is important to have a set of rules and stick to them.

E157a71a8b1585e6a33e2c6da01d4cac?s=128

Christian Leo-Pernold

February 13, 2020
Tweet

More Decks by Christian Leo-Pernold

Other Decks in Programming

Transcript

  1. None
  2. How to NOT fuck up your day 2/37

  3. About me ! Christian Leo-Pernold "#$%&'(⛰*+,- . @mazedlx ⭐ github.com/mazedlx

    0 mazedlx.net 1 repod.at 3/37
  4. Arbeitswelt & Schule PHP (CodeIgniter 3) MySQL Various types of

    workshops to choose from "Out of Control - was das Internet über dich weiß" (OOC) 4/37
  5. OOC - Details 3 time slots per day 09:00 -

    10:30 10:45 - 12:15 12:30 - 14:00 5/37
  6. 6/37

  7. So they ended up with this 09:00 - 10:15 10:15

    - 11:30 11:30 - 12:45 12:45 - 14:00 7/37
  8. 8/37

  9. The task at hand All dates for the first 6

    months of 2020 were already created Don't touch those that were already booked Edit all other dates and revert them to the original time slots Remove any superfluous fourth slot 9/37
  10. How I would normally do it Deactivate OOC Copy production

    DB down to my machine Write small PHP program that fetches the corresponding rows Make the program spit out SQL statements Test those SQL statements on my machine Make sure everything went as planned Do stuff on the production DB Activate OOC 10/37
  11. How it should've been done 11/37

  12. What really went down Wrote small PHP program on production

    server No tests, no dry runs Run the program Shit hits the fan 12/37
  13. What happened next All 2020 timeslots were updated to 2020-01-07

    09:00 - 10:30 That's about 400 rows Got a small export in Excel beforehand, just to be on the safe side Let's change 400 rows back to their initial state by hand 13/37
  14. ¯\_(ϑ)_/¯ 14/37

  15. 15/37

  16. But then... Hey Christian, there's something wrong with Arbeitswelt &

    Schule, every workshop shows up with the same date. — Some Administrator 16/37
  17. ಠ ಠ 䡞 17/37

  18. ಠ_ಠ 18/37

  19. ಠ~ಠ 19/37

  20. ಠoಠ 20/37

  21. ಠ_ಥ 21/37

  22. ಥ_ಥ 22/37

  23. (˽°□°҂˽Ɨ ˍʓˍ) 23/37

  24. 24/37

  25. Backups to the rescue! 25/37

  26. Steps to fix your fuck up 1. Stop right now.

    2. Turn on maintenance mode. 3. Inform key users. 4. Request backup. 5. Restore and make sure you didn’t fuck up too much. Backups tend to be older than 5 minutes ago. 6. Don’t fuck up again. 7. Live on. 26/37
  27. Learnings 27/37

  28. Database stuff is dangerous. 28/37

  29. Backups are important. 29/37

  30. No, they really are. 30/37

  31. Seriously, do backups! 31/37

  32. There’s (usually) no cmd/ctrl + z in your SQL tool

    of choice. 32/37
  33. There’s commit and rollback though. 33/37

  34. And there’s simulate query. 34/37

  35. Adhere to your rules - and trust yourself! 35/37

  36. I fucked up at least two times in my 15+

    years being a developer because I didn’t follow my own rules: 1. Copy production to local 2. Try stuff locally 3. Make sure everything went as expected 4. Then do stuff in production 5. Make sure you didn’t fuck up 6. Profit 36/37
  37. !" Slides can be found at speakerdeck.com/mazedlx 37/37