From 4b1ce7102e48e2d71bc63a49f7f928903517cbb9 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 25 Aug 2011 22:14:02 +0200 Subject: [PATCH] A few more tweaks as requested by Andreas. --- openlp/plugins/songs/lib/upgrade.py | 12 ++++++++++++ scripts/check_dependencies.py | 7 ++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/lib/upgrade.py b/openlp/plugins/songs/lib/upgrade.py index 56b04bb01..e0f2668d9 100644 --- a/openlp/plugins/songs/lib/upgrade.py +++ b/openlp/plugins/songs/lib/upgrade.py @@ -54,12 +54,24 @@ def upgrade_setup(metadata): def upgrade_1(session, metadata, tables): + """ + Version 1 upgrade. + + This upgrade removes the many-to-many relationship between songs and + media_files and replaces it with a one-to-many, which is far more + representative of the real relationship between the two entities. + + In order to facilitate this one-to-many relationship, a song_id column is + added to the media_files table, and a weight column so that the media + files can be ordered. + """ Table(u'media_files_songs', metadata, autoload=True).drop(checkfirst=True) Column(u'song_id', types.Integer(), default=None)\ .create(table=tables[u'media_files'], populate_default=True) Column(u'weight', types.Integer(), default=0)\ .create(table=tables[u'media_files'], populate_default=True) if metadata.bind.url.get_dialect().name != 'sqlite': + # SQLite doesn't support ALTER TABLE ADD CONSTRAINT ForeignKeyConstraint([u'song_id'], [u'songs.id'], table=tables[u'media_files']).create() diff --git a/scripts/check_dependencies.py b/scripts/check_dependencies.py index 7048ceeab..5f2e4c148 100755 --- a/scripts/check_dependencies.py +++ b/scripts/check_dependencies.py @@ -46,14 +46,14 @@ VERS = { 'sqlalchemy': '0.5', # pyenchant 1.6 required on Windows 'enchant': '1.6' if is_win else '1.3' - } +} # pywin32 WIN32_MODULES = [ 'win32com', 'win32ui', 'pywintypes', - ] +] MODULES = [ 'PyQt4', @@ -72,7 +72,8 @@ MODULES = [ 'enchant', 'BeautifulSoup', 'mako', - ] + 'migrate', +] OPTIONAL_MODULES = [