db: add forget_channel() and forget_plugin() methods
#2224
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Tin, really. Up to now it's been possible to delete a user (nick group) from the database, but not possible to forget about a channel or plugin without manually writing SQL for
db.execute(). Seemed like deletion of value groupings should be as parallel as possible, just like management of individual values is between the three types.I see these as most useful for cleaning up channels that the bot is leaving permanently, or for plugin authors to add graceful "uninstall preparation" features to clean up whatever detritus the plugin has left in the database.
Checklist
make qa(runsmake qualityandmake test)Notes
There's a deprecation & rename in here too, moving
delete_nick_group()toforget_nick_group(), but I kept it in a separate commit so it's easy to drop if that seems like a bad idea to the rest of y'all.I'm continuing to try and think of other useful cases that aren't covered by the existing database functions. Might follow up with methods to delete a given key from all nicks/channels. That also applies to the "I'm about to uninstall a plugin forever" situation.