From 81ebdd97ccffc43acbb9f70936093c58789af26c Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Tue, 12 May 2015 23:08:54 -0400 Subject: [PATCH] Database backend writes its plugin id in database.txt --- gramps/gen/db/dbconst.py | 4 +++- gramps/plugins/database/bsddb_support/write.py | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gramps/gen/db/dbconst.py b/gramps/gen/db/dbconst.py index 7b91ab7e6..e53535248 100644 --- a/gramps/gen/db/dbconst.py +++ b/gramps/gen/db/dbconst.py @@ -31,7 +31,8 @@ Declare constants used by database modules __all__ = ( ('DBPAGE', 'DBMODE', 'DBCACHE', 'DBLOCKS', 'DBOBJECTS', 'DBUNDO', 'DBEXT', 'DBMODE_R', 'DBMODE_W', 'DBUNDOFN', 'DBLOCKFN', - 'DBRECOVFN','BDBVERSFN', 'DBLOGNAME', 'SCHVERSFN', 'PCKVERSFN' + 'DBRECOVFN','BDBVERSFN', 'DBLOGNAME', 'SCHVERSFN', 'PCKVERSFN', + 'DBBACKEND' ) + ('PERSON_KEY', 'FAMILY_KEY', 'SOURCE_KEY', 'CITATION_KEY', @@ -47,6 +48,7 @@ DBUNDOFN = "undo.db" # File name of 'undo' database DBLOCKFN = "lock" # File name of lock file DBRECOVFN = "need_recover" # File name of recovery file BDBVERSFN = "bdbversion.txt"# File name of Berkeley DB version file +DBBACKEND = "database.txt" # File name of Database backend file SCHVERSFN = "schemaversion.txt"# File name of schema version file PCKVERSFN = "pickleupgrade.txt" # Indicator that pickle has been upgrade t Python3 DBLOGNAME = ".Db" # Name of logger diff --git a/gramps/plugins/database/bsddb_support/write.py b/gramps/plugins/database/bsddb_support/write.py index 42a5ad138..920bd2938 100644 --- a/gramps/plugins/database/bsddb_support/write.py +++ b/gramps/plugins/database/bsddb_support/write.py @@ -2428,6 +2428,11 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback): version = str(_DBVERSION) version_file.write(version) + versionpath = os.path.join(name, str(DBBACKEND)) + _LOG.debug("Write database backend file to 'bsddb'") + with open(versionpath, "w") as version_file: + version_file.write("bsddb") + self.metadata.close() self.env.close()