openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #11601
[Merge] lp:~trb143/openlp/bug-835427 into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/bug-835427 into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #835427 in OpenLP: "OpenLP crashes when no databases exists"
https://bugs.launchpad.net/openlp/+bug/835427
For more details, see:
https://code.launchpad.net/~trb143/openlp/bug-835427/+merge/73139
Handle missing tables and set the meta data to the correct value
--
https://code.launchpad.net/~trb143/openlp/bug-835427/+merge/73139
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/bug-835427 into lp:openlp.
=== modified file 'openlp/core/lib/db.py'
--- openlp/core/lib/db.py 2011-08-26 19:09:25 +0000
+++ openlp/core/lib/db.py 2011-08-27 15:07:24 +0000
@@ -90,7 +90,7 @@
version_meta = session.query(Metadata).get(u'version')
if version_meta is None:
version_meta = Metadata.populate(key=u'version', value=u'0')
- version = 0
+ version = 0 if tables else upgrade.__version__;
else:
version = int(version_meta.value)
if version > upgrade.__version__:
=== modified file 'openlp/plugins/songs/lib/upgrade.py'
--- openlp/plugins/songs/lib/upgrade.py 2011-08-27 08:15:55 +0000
+++ openlp/plugins/songs/lib/upgrade.py 2011-08-27 15:07:24 +0000
@@ -42,15 +42,18 @@
upgrade process. If you want to drop a table, you need to remove it from
here, and add it to your upgrade function.
"""
- tables = {
- u'authors': Table(u'authors', metadata, autoload=True),
- u'media_files': Table(u'media_files', metadata, autoload=True),
- u'song_books': Table(u'song_books', metadata, autoload=True),
- u'songs': Table(u'songs', metadata, autoload=True),
- u'topics': Table(u'topics', metadata, autoload=True),
- u'authors_songs': Table(u'authors_songs', metadata, autoload=True),
- u'songs_topics': Table(u'songs_topics', metadata, autoload=True)
- }
+ try:
+ tables = {
+ u'authors': Table(u'authors', metadata, autoload=True),
+ u'media_files': Table(u'media_files', metadata, autoload=True),
+ u'song_books': Table(u'song_books', metadata, autoload=True),
+ u'songs': Table(u'songs', metadata, autoload=True),
+ u'topics': Table(u'topics', metadata, autoload=True),
+ u'authors_songs': Table(u'authors_songs', metadata, autoload=True),
+ u'songs_topics': Table(u'songs_topics', metadata, autoload=True)
+ }
+ except:
+ tables = None
return tables
=== modified file 'openlp/plugins/songusage/lib/upgrade.py'
--- openlp/plugins/songusage/lib/upgrade.py 2011-08-27 06:12:03 +0000
+++ openlp/plugins/songusage/lib/upgrade.py 2011-08-27 15:07:24 +0000
@@ -40,9 +40,12 @@
upgrade process. If you want to drop a table, you need to remove it from
here, and add it to your upgrade function.
"""
- tables = {
- u'songusage_data': Table(u'songusage_data', metadata, autoload=True)
- }
+ try:
+ tables = {
+ u'songusage_data': Table(u'songusage_data', metadata, autoload=True)
+ }
+ except:
+ tables = None
return tables
Follow ups