diff --git a/gramps/gen/db/generic.py b/gramps/gen/db/generic.py index 023e413d4..9f4b2cf5e 100644 --- a/gramps/gen/db/generic.py +++ b/gramps/gen/db/generic.py @@ -625,9 +625,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback): # run backend-specific code: self._initialize(directory, username, password) - # We use the existence of the person table as a proxy for the database - # being new - if not self.dbapi.table_exists("person"): + if not self._schema_exists(): self._create_schema() self._set_metadata('version', str(self.VERSION[0])) diff --git a/gramps/plugins/db/dbapi/dbapi.py b/gramps/plugins/db/dbapi/dbapi.py index 425f5c7aa..72ff08c99 100644 --- a/gramps/plugins/db/dbapi/dbapi.py +++ b/gramps/plugins/db/dbapi/dbapi.py @@ -56,6 +56,15 @@ class DBAPI(DbGeneric): def _initialize(self, directory, username, password): 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): """ Create and update schema.