From 1adac78588f63aea8cf110c54ce6fed8415c92a5 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 26 Aug 2011 13:02:06 +0100 Subject: [PATCH 1/5] Add date fields to songs --- openlp/plugins/songs/lib/db.py | 5 ++++- openlp/plugins/songs/lib/upgrade.py | 19 +++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/openlp/plugins/songs/lib/db.py b/openlp/plugins/songs/lib/db.py index bee64b3ba..13ce24266 100644 --- a/openlp/plugins/songs/lib/db.py +++ b/openlp/plugins/songs/lib/db.py @@ -31,6 +31,7 @@ the Songs plugin from sqlalchemy import Column, ForeignKey, Table, types from sqlalchemy.orm import mapper, relation +from sqlalchemy.sql.expression import func from openlp.core.lib.db import BaseModel, init_db @@ -195,7 +196,9 @@ def init_schema(url): Column(u'song_number', types.Unicode(64)), Column(u'theme_name', types.Unicode(128)), Column(u'search_title', types.Unicode(255), index=True, nullable=False), - Column(u'search_lyrics', types.UnicodeText, nullable=False) + Column(u'search_lyrics', types.UnicodeText, nullable=False), + Column(u'create_date', types.DateTime(), default=func.now()), + Column(u'last_modified', types.DateTime(), onupdate=func.now()) ) # Definition of the "topics" table diff --git a/openlp/plugins/songs/lib/upgrade.py b/openlp/plugins/songs/lib/upgrade.py index e0f2668d9..fae3400c2 100644 --- a/openlp/plugins/songs/lib/upgrade.py +++ b/openlp/plugins/songs/lib/upgrade.py @@ -25,15 +25,16 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### """ -The :mod:`upgrade` module provides a way for the database and schema that is the backend for -the Songs plugin +The :mod:`upgrade` module provides a way for the database and schema that is the +backend for the Songs plugin """ from sqlalchemy import Column, ForeignKey, Table, types +from sqlalchemy.sql.expression import func from migrate import changeset from migrate.changeset.constraint import ForeignKeyConstraint -__version__ = 1 +__version__ = 2 def upgrade_setup(metadata): """ @@ -57,7 +58,7 @@ def upgrade_1(session, metadata, tables): """ Version 1 upgrade. - This upgrade removes the many-to-many relationship between songs and + 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. @@ -75,3 +76,13 @@ def upgrade_1(session, metadata, tables): ForeignKeyConstraint([u'song_id'], [u'songs.id'], table=tables[u'media_files']).create() +def upgrade_2(session, metadata, tables): + """ + Version 2 upgrade. + + This upgrade adds a create_date and last_modified date to the songs table + """ + Column(u'create_date', types.DateTime(), default=func.now())\ + .create(table=tables[u'songs'], populate_default=True) + Column(u'last_modified', types.DateTime(), default=func.now())\ + .create(table=tables[u'songs'], populate_default=True) From 8f2b2381eea910d3c58f0a1ed8aa367e89bd65df Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Fri, 26 Aug 2011 14:14:21 +0200 Subject: [PATCH 2/5] Fixed a missing dependency (which already exists on the build server). --- resources/debian/debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/debian/debian/control b/resources/debian/debian/control index 423d81df0..a1c2298e9 100644 --- a/resources/debian/debian/control +++ b/resources/debian/debian/control @@ -11,7 +11,7 @@ Package: openlp Architecture: all Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, python-qt4, python-qt4-phonon, python-sqlalchemy, python-chardet, python-beautifulsoup, - python-lxml, python-sqlite, python-enchant, python-migrate + python-lxml, python-sqlite, python-enchant, python-mako, python-migrate Conflicts: python-openlp Description: Church lyrics projection application OpenLP is free church presentation software, or lyrics projection software, From 4f0c7716bc2c53067de6722716a05f17bbc0981d Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 26 Aug 2011 14:13:32 +0100 Subject: [PATCH 3/5] Fix default value --- openlp/plugins/songs/lib/db.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/db.py b/openlp/plugins/songs/lib/db.py index 13ce24266..5bfa0c830 100644 --- a/openlp/plugins/songs/lib/db.py +++ b/openlp/plugins/songs/lib/db.py @@ -198,7 +198,8 @@ def init_schema(url): Column(u'search_title', types.Unicode(255), index=True, nullable=False), Column(u'search_lyrics', types.UnicodeText, nullable=False), Column(u'create_date', types.DateTime(), default=func.now()), - Column(u'last_modified', types.DateTime(), onupdate=func.now()) + Column(u'last_modified', types.DateTime(), default=func.now(), + onupdate=func.now()) ) # Definition of the "topics" table From fbb32a027880259eec86bf5219bfdd86ef7e3ebd Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 26 Aug 2011 17:30:51 +0200 Subject: [PATCH 4/5] added hints that exported files are OpenLyrics files --- openlp/plugins/songs/forms/songexportform.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/forms/songexportform.py b/openlp/plugins/songs/forms/songexportform.py index 90c3b0275..3d3c4d559 100644 --- a/openlp/plugins/songs/forms/songexportform.py +++ b/openlp/plugins/songs/forms/songexportform.py @@ -170,8 +170,8 @@ class SongExportForm(OpenLPWizard): translate('OpenLP.Ui', 'Welcome to the Song Export Wizard')) self.informationLabel.setText( translate('SongsPlugin.ExportWizardForm', 'This wizard will help to' - ' export your songs to the open and free OpenLyrics worship song ' - 'format.')) + ' export your songs to the open and free OpenLyrics' + ' worship song format.')) self.availableSongsPage.setTitle( translate('SongsPlugin.ExportWizardForm', 'Select Songs')) self.availableSongsPage.setSubTitle( @@ -285,7 +285,9 @@ class SongExportForm(OpenLPWizard): self, songs, unicode(self.directoryLineEdit.text())) if exporter.do_export(): self.progressLabel.setText( - translate('SongsPlugin.SongExportForm', 'Finished export.')) + translate('SongsPlugin.SongExportForm', 'Finished export. To ' + 'import these files again use the OpenLyrics ' + 'importer.')) else: self.progressLabel.setText( translate('SongsPlugin.SongExportForm', From d88a268c5cfcc9b4bc589ed5a21f7ac81e50aa80 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 26 Aug 2011 17:48:58 +0200 Subject: [PATCH 5/5] removed 'again' --- openlp/plugins/songs/forms/songexportform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/forms/songexportform.py b/openlp/plugins/songs/forms/songexportform.py index 3d3c4d559..22020a401 100644 --- a/openlp/plugins/songs/forms/songexportform.py +++ b/openlp/plugins/songs/forms/songexportform.py @@ -286,7 +286,7 @@ class SongExportForm(OpenLPWizard): if exporter.do_export(): self.progressLabel.setText( translate('SongsPlugin.SongExportForm', 'Finished export. To ' - 'import these files again use the OpenLyrics ' + 'import these files use the OpenLyrics ' 'importer.')) else: self.progressLabel.setText(