banshee r4166 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Database
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4166 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Database
- Date: Wed, 18 Jun 2008 18:26:22 +0000 (UTC)
Author: gburt
Date: Wed Jun 18 18:26:22 2008
New Revision: 4166
URL: http://svn.gnome.org/viewvc/banshee?rev=4166&view=rev
Log:
2008-06-18 Gabriel Burt <gabriel burt gmail com>
* src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs:
Fix crasher caused by trying to migrate playlist data from old (pre
0.13.2) versions of Banshee (BGO #538993).
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs Wed Jun 18 18:26:22 2008
@@ -672,22 +672,39 @@
FROM Tracks
", (int)TrackMediaAttributes.Default, (int)StreamPlaybackError.None));
- Execute ("update coretracks set lastplayedstamp = NULL where lastplayedstamp = -62135575200");
+ Execute ("UPDATE CoreTracks SET LastPlayedStamp = NULL WHERE LastPlayedStamp = -62135575200");
- Execute(@"
- INSERT INTO CorePlaylists (PlaylistID, Name, SortColumn, SortType)
- SELECT * FROM Playlists
- ");
-
- Execute(@"
- INSERT INTO CorePlaylistEntries
- SELECT * FROM PlaylistEntries
- ");
-
- Execute(@"
- INSERT INTO CoreSmartPlaylists (SmartPlaylistID, Name, Condition, OrderBy, LimitNumber, LimitCriterion)
- SELECT * FROM SmartPlaylists
- ");
+ // Old versions of Banshee had different columns for Playlists/PlaylistEntries, so be careful
+ try {
+ Execute(@"
+ INSERT INTO CorePlaylists (PlaylistID, Name, SortColumn, SortType)
+ SELECT * FROM Playlists;
+ INSERT INTO CorePlaylistEntries
+ SELECT * FROM PlaylistEntries
+ ");
+ } catch (Exception e) {
+ Log.Exception ("Must be a pre-0.13.2 banshee.db, attempting to migrate", e);
+ try {
+ Execute(@"
+ INSERT INTO CorePlaylists (PlaylistID, Name)
+ SELECT PlaylistID, Name FROM Playlists;
+ INSERT INTO CorePlaylistEntries (EntryID, PlaylistID, TrackID)
+ SELECT EntryID, PlaylistID, TrackID FROM PlaylistEntries
+ ");
+ Log.Debug ("Success, was able to migrate older playlist information");
+ } catch (Exception e2) {
+ Log.Exception ("Failed to migrate playlists", e2);
+ }
+ }
+
+
+ // Really old versions of Banshee didn't have SmartPlaylists, so ignore errors
+ try {
+ Execute(@"
+ INSERT INTO CoreSmartPlaylists (SmartPlaylistID, Name, Condition, OrderBy, LimitNumber, LimitCriterion)
+ SELECT * FROM SmartPlaylists
+ ");
+ } catch {}
Execute ("UPDATE CoreSmartPlaylists SET PrimarySourceID = 1");
Execute ("UPDATE CorePlaylists SET PrimarySourceID = 1");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]