The database gods have shown their favor
·
I was adding some new functionality to the site: display featured posts on the home page. Tag a post as featured by clicking a star icon. ez - but noOoOoo, things had to go and get all complicated. I made the change to ALTER the posts table with the featured flag. I know, it probably should have gone in a separate table but whatever. You already know where this is going.
I accidentally truncated the whole posts table because of a misunderstanding about how Drizzle works. But hey, I didn't panic so that's good. What I did do: looked for a backup, realized it was two months old, cursed my own name. Then, I pieced together whatever I could, which was about 30 posts short of what I actually had. I restored it and found a bug in my restore logic. Of course. Yack shaving time.
Fast forward a couple of hours. The fix was in. I had to truncate the tags/posts table because the IDs for the posts I found were different from the post IDs in the lookup table. That caused an error when I tried to import. Still missing about 30 posts.
As I was combing through my downloads folder, I found a full backup from days ago. I don't even remember making it. Thank the database gods.