Database upgrade to convert default handle to str

This commit is contained in:
Nick Hall 2017-05-30 19:23:48 +01:00
parent 5939e722e4
commit 16cd995558
2 changed files with 14 additions and 1 deletions

View File

@ -77,6 +77,17 @@ def gramps_upgrade_pickle(self):
with BSDDBTxn(self.env, self.metadata) as txn:
txn.put(b'upgraded', 'Yes')
def gramps_upgrade_19(self):
"""
Upgrade database from version 18 to 19.
"""
default_handle = self.metadata.get(b'default')
with BSDDBTxn(self.env, self.metadata) as txn:
if default_handle is not None:
default_handle = default_handle.decode('utf-8')
txn.put(b'default', default_handle)
txn.put(b'version', 19)
def gramps_upgrade_18(self):
"""
Upgrade database from version 17 to 18.

View File

@ -87,7 +87,7 @@ LOG = logging.getLogger(".citation")
#_hdlr.setFormatter(logging.Formatter(fmt="%(name)s.%(levelname)s: %(message)s"))
#_LOG.addHandler(_hdlr)
_MINVERSION = 9
_DBVERSION = 18
_DBVERSION = 19
IDTRANS = "person_id"
FIDTRANS = "family_id"
@ -2159,6 +2159,8 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
upgrade.gramps_upgrade_17(self)
if version < 18:
upgrade.gramps_upgrade_18(self)
if version < 19:
upgrade.gramps_upgrade_19(self)
self.reset()
self.set_total(6)