forked from openlp/openlp
fix upgrade_db
This commit is contained in:
parent
5e8ad1710b
commit
a6dfbdcf71
@ -145,9 +145,13 @@ def upgrade_db(url, upgrade):
|
|||||||
version_meta = session.query(Metadata).get('version')
|
version_meta = session.query(Metadata).get('version')
|
||||||
if version_meta is None:
|
if version_meta is None:
|
||||||
# Tables have just been created - fill the version field with the most recent version
|
# Tables have just been created - fill the version field with the most recent version
|
||||||
|
if session.query(Metadata).get('dbversion'):
|
||||||
|
version = 0
|
||||||
|
else:
|
||||||
version = upgrade.__version__
|
version = upgrade.__version__
|
||||||
version_meta = Metadata.populate(key='version', value=version)
|
version_meta = Metadata.populate(key='version', value=version)
|
||||||
session.add(version_meta)
|
session.add(version_meta)
|
||||||
|
session.commit()
|
||||||
else:
|
else:
|
||||||
version = int(version_meta.value)
|
version = int(version_meta.value)
|
||||||
if version > upgrade.__version__:
|
if version > upgrade.__version__:
|
||||||
|
Loading…
Reference in New Issue
Block a user