Create _schema_exists method
This commit is contained in:
parent
cf42e5a4b8
commit
75bf103429
@ -625,9 +625,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
|||||||
# run backend-specific code:
|
# run backend-specific code:
|
||||||
self._initialize(directory, username, password)
|
self._initialize(directory, username, password)
|
||||||
|
|
||||||
# We use the existence of the person table as a proxy for the database
|
if not self._schema_exists():
|
||||||
# being new
|
|
||||||
if not self.dbapi.table_exists("person"):
|
|
||||||
self._create_schema()
|
self._create_schema()
|
||||||
self._set_metadata('version', str(self.VERSION[0]))
|
self._set_metadata('version', str(self.VERSION[0]))
|
||||||
|
|
||||||
|
@ -56,6 +56,15 @@ class DBAPI(DbGeneric):
|
|||||||
def _initialize(self, directory, username, password):
|
def _initialize(self, directory, username, password):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def _schema_exists(self):
|
||||||
|
"""
|
||||||
|
Check to see if the schema exists.
|
||||||
|
|
||||||
|
We use the existence of the person table as a proxy for the database
|
||||||
|
being new.
|
||||||
|
"""
|
||||||
|
return self.dbapi.table_exists("person")
|
||||||
|
|
||||||
def _create_schema(self):
|
def _create_schema(self):
|
||||||
"""
|
"""
|
||||||
Create and update schema.
|
Create and update schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user