[omemo] database migration to version 8 fails
In commit d036b0f6, the column private_key
was removed from the identities
field in the database and that information moved to the new table secrets
. To be precise, since that commit, newly created databases don't include that column in identities
anymore. The migration from version 5 to 6 correspondingly creates the table secrets
and moves the data over from identities
, but does not delete the column in identities
.
In commit c39c3c80 from last week, a new migration from version 7 to 8 was added to sanitize some BLOB
s. But this still uses the private_key
column from the identites
table, so leads to an error for users that created the database after commit d036b0f6.
As private_key
from identities
is not supposed to be used anymore, perhaps this migration should be changed to not read that column and when re-inserting leave that field blank. Then both users where the migration succeeds only after the fix and those for which it already ran will have identities
with sanitized BLOB
(except possibly the private_key
column, which we don't care about anymore). Then add a migration to a new version 9 to delete the deprecated column if it exists as well as sanitizing the BLOB
in secrets
. Doing both at once is probably not a good idea as for some users having an older database, the migration might have already succeeded. I would be happy to try to put something like this together if that would be useful.
Here is the traceback from launching gajim with the current master of gajim (commit gajim@a7bc6dc5) and gajim-plugins (commit 33223f7a)
No translations found
Dirs searched: [PosixPath('/usr/local/share'), PosixPath('/usr/share')]
Traceback (most recent call last):
File "/home/user/gajim/gajim/application.py", line 229, in _activate
self.interface.run(self)
File "/home/user/gajim/gajim/gui_interface.py", line 2282, in run
app.plugin_manager.init_plugins()
File "/home/user/gajim/gajim/plugins/helpers.py", line 114, in wrapper
result = f(*args, **kwargs)
File "/home/user/gajim/gajim/plugins/pluginmanager.py", line 176, in init_plugins
self._activate_all_plugins_from_global_config()
File "/home/user/gajim/gajim/plugins/pluginmanager.py", line 546, in _activate_all_plugins_from_global_config
self.activate_plugin(plugin)
File "/home/user/gajim/gajim/plugins/helpers.py", line 114, in wrapper
result = f(*args, **kwargs)
File "/home/user/gajim/gajim/plugins/pluginmanager.py", line 451, in activate_plugin
self._register_modules_with_handlers(plugin)
File "/home/user/gajim/gajim/plugins/pluginmanager.py", line 411, in _register_modules_with_handlers
instance, name = module.get_instance(con)
File "/home/user/.local/share/gajim/plugins/omemo/modules/omemo.py", line 504, in get_instance
return OMEMO(*args, **kwargs), 'OMEMO'
File "/home/user/.local/share/gajim/plugins/omemo/modules/omemo.py", line 105, in __init__
self._backend = self._get_backend()
File "/home/user/.local/share/gajim/plugins/omemo/modules/omemo.py", line 125, in _get_backend
return OmemoState(self._own_jid, db_path, self._account, self)
File "/home/user/.local/share/gajim/plugins/omemo/backend/state.py", line 57, in __init__
self._storage = LiteAxolotlStore(db_path, self._log)
File "/home/user/.local/share/gajim/plugins/omemo/backend/liteaxolotlstore.py", line 65, in __init__
self.migrateDb()
File "/home/user/.local/share/gajim/plugins/omemo/backend/liteaxolotlstore.py", line 265, in migrateDb
rows = self._con.execute(query_keys).fetchall()
sqlite3.OperationalError: no such column: private_key