Undo a card answer using the database

Because I missed the chance to use the client-side Undo function, I went into the database, in the revlog table, and deleted the most recent entry for that card ID. Using the Browser, I can now see that card again under Today > Due. I can also see in the Card Info window that the last answer no longer appears, and its Due Date has been set back again to Today. However, I also noticed that the total count of Due Cards for today hasn’t changed in the main window (it should have increased by 1); interestingly, this number is lower than the total number of cards listed under Today > Due in the Browser.

Is this the correct way to undo an answer? Since the Due Count in the main window hasn’t increased, does it mean something went wrong?

I’m really sorry you tried to do this on your own. If you’d asked in advance, I think you would have gotten a strong recommendation to just leave that review log where it was. Databases are complicated, and one review log is almost never going to cause you long-term pain.

Probably top on the list of ways to try getting past this is – run Tools > Check Database. If that doesn’t set things right, the next-least-invasive thing I can think of is to study the card – pull it into a Filtered deck, or try using “Set Due Date” to set it to be studied today.

If you want to actually fix it, restoring an automatic backup from before you deleted the revlog is a reasonable way to do that – Restoring an Automatic Backup (Recovering from Data Loss) - Anki FAQs . To minimize data loss for things you’ve done since then, you can import that backup into a brand new (temporary) profile, find that one note you’re looking for, export it, and then import it into your main profile.

1 Like

Thanks @Danika_Dakika for your input. I don’t think there is anything sacred about the backend and I’d like to understand how it works. Perhaps someone can provide the technical details.

No, not sacred – just full of interdependencies and not something to be monkeyed with unnecessarily.

But here’s the database structure (probably slightly outdated, but should give you a good start), and here’s the code. Enjoy! :+1:t4: