Skip to content

Conversation

@dgw
Copy link
Member

@dgw dgw commented Dec 19, 2021

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

  • I have read CONTRIBUTING.md
  • I can and do license this contribution under the EFLv2
  • No issues are reported by make qa (runs make quality and make test)
  • I have tested the functionality of the things this change touches

Notes

There's a deprecation & rename in here too, moving delete_nick_group() to forget_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.

@dgw dgw added the Feature label Dec 19, 2021
@dgw dgw added this to the 8.0.0 milestone Dec 19, 2021
@dgw dgw requested a review from a team December 19, 2021 07:18
dgw added 2 commits December 19, 2021 01:21
Mostly envisioned as "pre-uninstall" utilities for plugins to offer, but
could theoretically become part of a manual database-optimizer wizard
built into Sopel's command line or other admin tools.

We could add a tool to Sopel in the future that, for example, offers to
purge values stored for channels that aren't listed in `core.channels`,
and maybe even for plugins that `plugins.enumerate_plugins()` can't find
any more (assuming plugin authors generally stick to their plugins'
names when calling `db.set_plugin_value()`).
Old name marked as deprecated, to stick around until 9.0.
@dgw dgw force-pushed the db-delete-channels-and-plugins branch from db89b4a to d1fa1c9 Compare December 19, 2021 07:21
Copy link
Contributor

@Exirel Exirel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me. Even tho I know for a fact that it might have a slight conflict with something I'm working on to implement the weird identifier logic.

@dgw dgw merged commit 5ef0471 into master Dec 24, 2021
@dgw dgw deleted the db-delete-channels-and-plugins branch December 24, 2021 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants