9547: Rename non-API database upgrade methods
This commit is contained in:
parent
535ce58f17
commit
095e0e529f
@ -879,12 +879,6 @@ class DbReadBase:
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def gramps_upgrade(self):
|
||||
"""
|
||||
Return True if database is upgraded
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def has_event_handle(self, handle):
|
||||
"""
|
||||
Return True if the handle exists in the current Event database.
|
||||
@ -1582,12 +1576,6 @@ class DbWriteBase(DbReadBase):
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def need_schema_upgrade(self):
|
||||
"""
|
||||
Return True if database needs to be upgraded
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def rebuild_secondary(self, callback):
|
||||
"""
|
||||
Rebuild secondary indices
|
||||
|
@ -122,7 +122,6 @@ class DbTest(unittest.TestCase):
|
||||
"get_tag_handles",
|
||||
"get_surname_list",
|
||||
"get_url_types",
|
||||
"gramps_upgrade",
|
||||
"has_event_handle",
|
||||
"has_family_handle",
|
||||
"has_gramps_id",
|
||||
@ -194,7 +193,6 @@ class DbTest(unittest.TestCase):
|
||||
"commit_repository",
|
||||
"commit_source",
|
||||
"commit_tag",
|
||||
"need_schema_upgrade",
|
||||
"rebuild_secondary",
|
||||
"reindex_reference_map",
|
||||
"remove_event",
|
||||
|
@ -684,7 +684,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
return ((dbversion <= _DBVERSION) and (dbversion >= _MINVERSION))
|
||||
|
||||
@catch_db_error
|
||||
def need_schema_upgrade(self):
|
||||
def _need_schema_upgrade(self):
|
||||
dbversion = self.metadata.get(b'version', default=0)
|
||||
return not self.readonly and dbversion < _DBVERSION
|
||||
|
||||
@ -901,13 +901,13 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
|
||||
self.__load_metadata()
|
||||
|
||||
if self.need_schema_upgrade():
|
||||
if self._need_schema_upgrade():
|
||||
oldschema = self.metadata.get(b'version', default=0)
|
||||
newschema = _DBVERSION
|
||||
_LOG.debug("Schema upgrade required from %s to %s" %
|
||||
(oldschema, newschema))
|
||||
if force_schema_upgrade == True:
|
||||
self.gramps_upgrade(callback)
|
||||
self._gramps_upgrade(callback)
|
||||
versionpath = os.path.join(name, str(SCHVERSFN))
|
||||
with open(versionpath, "w") as version_file:
|
||||
version = str(_DBVERSION)
|
||||
@ -2335,7 +2335,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
def redo(self, update_history=True):
|
||||
return self.undodb.redo(update_history)
|
||||
|
||||
def gramps_upgrade(self, callback=None):
|
||||
def _gramps_upgrade(self, callback=None):
|
||||
UpdateCallback.__init__(self, callback)
|
||||
|
||||
version = self.metadata.get(b'version', default=_MINVERSION)
|
||||
|
@ -1236,14 +1236,6 @@ class DummyDb(M_A_M_B("NewBaseClass", (DbReadBase, Callback, object,), {})):
|
||||
LOG.warn("database is closed")
|
||||
return []
|
||||
|
||||
def gramps_upgrade(self):
|
||||
"""
|
||||
Return True if database is upgraded
|
||||
"""
|
||||
if not self.db_is_open:
|
||||
LOG.warn("database is closed")
|
||||
return True
|
||||
|
||||
def has_event_handle(self, handle):
|
||||
"""
|
||||
Return True if the handle exists in the current Event database.
|
||||
|
Loading…
Reference in New Issue
Block a user