Remove get_schema_version method

Issue #9541.
This commit is contained in:
Nick Hall 2017-09-30 17:28:11 +01:00
parent e38614291d
commit 96f430480b
2 changed files with 0 additions and 32 deletions

View File

@ -50,7 +50,6 @@ from ..errors import HandleError
from ..utils.callback import Callback from ..utils.callback import Callback
from ..updatecallback import UpdateCallback from ..updatecallback import UpdateCallback
from .bookmarks import DbBookmarks from .bookmarks import DbBookmarks
from . import exceptions
from ..utils.id import create_id from ..utils.id import create_id
from ..lib.researcher import Researcher 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 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: # run backend-specific code:
self._initialize(directory) self._initialize(directory)
@ -770,13 +763,6 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
"""Return True when the file has a supported version.""" """Return True when the file has a supported version."""
return True 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): def _get_table_func(self, table=None, func=None):
""" """
Private implementation of get_table_func. Private implementation of get_table_func.

View File

@ -53,24 +53,6 @@ class DBAPI(DbGeneric):
""" """
Database backends class for DB-API 2.0 databases 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): def write_version(self, directory):
"""Write files for a newly created DB.""" """Write files for a newly created DB."""
_LOG.debug("Write schema version file to %s", str(self.VERSION[0])) _LOG.debug("Write schema version file to %s", str(self.VERSION[0]))