sopel-irc / sopel-remind

Other
0 stars 1 forks source link

Migration from core `remind` plugin #1

Closed dgw closed 1 year ago

dgw commented 2 years ago

Was thinking about the transition from core's remind to this today, and more specifically considering the data migration path.

Reading the core plugin's ".db" file (actually TSV) is really easy with csv.reader(..., delimiter='\t'). I'm just curious if you have any thoughts about where the actual migration would go: Part of the backend.setup() routine, a separate conversion script for the bot owner to run manually, or somewhere else.

Actually doing the migration is really simple, assuming the timestamp field this plugin saves is equivalent to the core plugin's. I think it should be. For best-effort timezone safety, knowing that the output of time.gmtime(time.time()) is specified to be in UTC, unlike time.time() by itself (what core remind uses), the migration can pass the core plugin's timestamps through time.mktime(time.gmtime(original_timestamp)) to be Reasonably Sure™ that the final result will be in UTC.

Everything else is just more details, like if an automatic migration would rename the original file, or store a flag somewhere to skip migration after running it once, that kind of thing.

Exirel commented 1 year ago

And done!