Create the schema within a transaction

This commit is contained in:
Nick Hall 2017-01-21 20:52:48 +00:00
parent 3b06bf10dd
commit c7bbc01b20

View File

@ -128,6 +128,8 @@ class DBAPI(DbGeneric):
""" """
Create and update schema. Create and update schema.
""" """
self.dbapi.begin()
# make sure schema is up to date: # make sure schema is up to date:
self.dbapi.execute('CREATE TABLE person ' self.dbapi.execute('CREATE TABLE person '
'(' '('
@ -261,6 +263,7 @@ class DBAPI(DbGeneric):
self.dbapi.execute('CREATE INDEX reference_obj_handle ' self.dbapi.execute('CREATE INDEX reference_obj_handle '
'ON reference(obj_handle)') 'ON reference(obj_handle)')
self.dbapi.commit()
def _close(self): def _close(self):
self.dbapi.close() self.dbapi.close()