From 96f430480bdd1e904f919932a5c864bcc1acaa65 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Sat, 30 Sep 2017 17:28:11 +0100 Subject: [PATCH] Remove get_schema_version method Issue #9541. --- gramps/gen/db/generic.py | 14 -------------- gramps/plugins/db/dbapi/dbapi.py | 18 ------------------ 2 files changed, 32 deletions(-) diff --git a/gramps/gen/db/generic.py b/gramps/gen/db/generic.py index 4ec3b0540..f8a0464bb 100644 --- a/gramps/gen/db/generic.py +++ b/gramps/gen/db/generic.py @@ -50,7 +50,6 @@ from ..errors import HandleError from ..utils.callback import Callback from ..updatecallback import UpdateCallback from .bookmarks import DbBookmarks -from . import exceptions from ..utils.id import create_id from ..lib.researcher import Researcher @@ -592,12 +591,6 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback): """ If update is False: then don't update any files """ - db_schema_version = self.get_schema_version(directory) - current_schema_version = self.VERSION[0] - if db_schema_version != current_schema_version: - raise exceptions.DbVersionError(str(db_schema_version), - str(current_schema_version), - str(current_schema_version)) # run backend-specific code: self._initialize(directory) @@ -770,13 +763,6 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback): """Return True when the file has a supported version.""" return True - def get_schema_version(self, directory=None): - """ - Get the version of the schema that the database was created - under. Assumes 18, if not found. - """ - raise NotImplementedError - def _get_table_func(self, table=None, func=None): """ Private implementation of get_table_func. diff --git a/gramps/plugins/db/dbapi/dbapi.py b/gramps/plugins/db/dbapi/dbapi.py index bbdbeb8ee..da0bd75cb 100644 --- a/gramps/plugins/db/dbapi/dbapi.py +++ b/gramps/plugins/db/dbapi/dbapi.py @@ -53,24 +53,6 @@ class DBAPI(DbGeneric): """ Database backends class for DB-API 2.0 databases """ - def get_schema_version(self, directory=None): - """ - Get the version of the schema that the database was created - under. Assumes 18, if not found. - """ - if directory is None: - directory = self._directory - version = 18 - if directory: - versionpath = os.path.join(directory, "schemaversion.txt") - if os.path.exists(versionpath): - with open(versionpath, "r") as version_file: - version = version_file.read() - version = int(version) - else: - LOG.info("Missing '%s'. Assuming version 18.", versionpath) - return version - def write_version(self, directory): """Write files for a newly created DB.""" _LOG.debug("Write schema version file to %s", str(self.VERSION[0]))