Merge lp:~raoul-snyman/openlp/bug-896977 into lp:openlp

Proposed by Raoul Snyman
Status: Merged
Approved by: Tim Bentley
Approved revision: 1807
Merged at revision: 1809
Proposed branch: lp:~raoul-snyman/openlp/bug-896977
Merge into: lp:openlp
Diff against target: 25 lines (+5/-4)
1 file modified
openlp/plugins/songs/lib/upgrade.py (+5/-4)
To merge this branch: bzr merge lp:~raoul-snyman/openlp/bug-896977
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Review via email: mp+83531@code.launchpad.net

Commit message

Removed 'populate_default' arguments as they are not supported in older versions of migrate.

Description of the change

Fixed bug #896977 by removing 'populate_default' arguments as they are not supported in older versions of migrate.

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote :

If you remove the populate_default then we need a mechanism to handle the defining of the fields as the values may not be as expected.

review: Needs Information
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

In the first upgrade, it is not needed, since the "populate_default" was on a new table, which would not have any rows in it.

In the second upgrade, I'm not too sure how accurate it would be to set all the created and modified datetimes of the songs to the moment of the upgrade. It would be incorrect on both counts. Any ideas for a possible alternative?

Revision history for this message
Tim Bentley (trb143) wrote :

No but I will think as I have another change planned which will need an update

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/plugins/songs/lib/upgrade.py'
2--- openlp/plugins/songs/lib/upgrade.py 2011-10-03 20:12:57 +0000
3+++ openlp/plugins/songs/lib/upgrade.py 2011-11-27 21:29:24 +0000
4@@ -68,9 +68,9 @@
5 """
6 Table(u'media_files_songs', metadata, autoload=True).drop(checkfirst=True)
7 Column(u'song_id', types.Integer(), default=None)\
8- .create(table=tables[u'media_files'], populate_default=True)
9+ .create(table=tables[u'media_files'])
10 Column(u'weight', types.Integer(), default=0)\
11- .create(table=tables[u'media_files'], populate_default=True)
12+ .create(table=tables[u'media_files'])
13 if metadata.bind.url.get_dialect().name != 'sqlite':
14 # SQLite doesn't support ALTER TABLE ADD CONSTRAINT
15 ForeignKeyConstraint([u'song_id'], [u'songs.id'],
16@@ -83,6 +83,7 @@
17 This upgrade adds a create_date and last_modified date to the songs table
18 """
19 Column(u'create_date', types.DateTime(), default=func.now())\
20- .create(table=tables[u'songs'], populate_default=True)
21+ .create(table=tables[u'songs'])
22 Column(u'last_modified', types.DateTime(), default=func.now())\
23- .create(table=tables[u'songs'], populate_default=True)
24+ .create(table=tables[u'songs'])
25+