[banshee/grid] Undo the metadata version bump in commit e7969e5



commit c57923473576d44d2175829f2dcc525675bd6fb6
Author: Alexander Kojevnikov <alexander kojevnikov com>
Date:   Sun Nov 22 10:07:51 2009 +1100

    Undo the metadata version bump in commit e7969e5
    
    The transaction had to be removed from SortKeyUpdater.ForceUpdate()
    to avoid nested transactions during database migration.
    
    If you run from git master and have the bumped metadata version,
    you can run this query to revert it:
    
    sqlite> UPDATE CoreConfiguration SET Value='6' WHERE Key='MetadataVersion';

 .../Banshee.Database/BansheeDbConnection.cs        |    8 +++++++-
 .../Banshee.Database/BansheeDbFormatMigrator.cs    |   15 +++++++++++++--
 .../Banshee.Database/SortKeyUpdater.cs             |    4 +---
 3 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Database/BansheeDbConnection.cs b/src/Core/Banshee.Services/Banshee.Database/BansheeDbConnection.cs
index e8267ac..e2dfa36 100644
--- a/src/Core/Banshee.Services/Banshee.Database/BansheeDbConnection.cs
+++ b/src/Core/Banshee.Services/Banshee.Database/BansheeDbConnection.cs
@@ -85,7 +85,13 @@ namespace Banshee.Database
                 }
 
                 // Update cached sorting keys
-                SortKeyUpdater.Update ();
+                BeginTransaction ();
+                try {
+                    SortKeyUpdater.Update ();
+                    CommitTransaction ();
+                } catch {
+                    RollbackTransaction ();
+                }
             }
         }
 
diff --git a/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs b/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
index 85f8c5d..5f61bef 100644
--- a/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
+++ b/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
@@ -56,8 +56,8 @@ namespace Banshee.Database
         // NOTE: Whenever there is a change in ANY of the database schema,
         //       this version MUST be incremented and a migration method
         //       MUST be supplied to match the new version number
-        protected const int CURRENT_VERSION = 36;
-        protected const int CURRENT_METADATA_VERSION = 7;
+        protected const int CURRENT_VERSION = 37;
+        protected const int CURRENT_METADATA_VERSION = 6;
 
 #region Migration Driver
 
@@ -829,6 +829,17 @@ namespace Banshee.Database
 
 #endregion
 
+#region Version 37
+
+        [DatabaseVersion (37)]
+        private bool Migrate_37 ()
+        {
+            SortKeyUpdater.ForceUpdate ();
+            return true;
+        }
+
+#endregion
+
 #pragma warning restore 0169
 
 #region Fresh database setup
diff --git a/src/Core/Banshee.Services/Banshee.Database/SortKeyUpdater.cs b/src/Core/Banshee.Services/Banshee.Database/SortKeyUpdater.cs
index 5ca91f1..ed272cc 100644
--- a/src/Core/Banshee.Services/Banshee.Database/SortKeyUpdater.cs
+++ b/src/Core/Banshee.Services/Banshee.Database/SortKeyUpdater.cs
@@ -52,7 +52,6 @@ namespace Banshee.Database
         protected static void ForceUpdate (string new_locale)
         {
             ServiceManager.DbConnection.Execute (@"
-                    BEGIN;
                     UPDATE CoreArtists SET
                         NameSortKey       = HYENA_COLLATION_KEY(COALESCE(NameSort, Name, ?)),
                         NameLowered       = HYENA_SEARCH_KEY(COALESCE(Name, ?));
@@ -65,8 +64,7 @@ namespace Banshee.Database
 
                     UPDATE CoreTracks SET
                         TitleSortKey      = HYENA_COLLATION_KEY(COALESCE(TitleSort, Title, ?)),
-                        TitleLowered      = HYENA_SEARCH_KEY(COALESCE(Title, ?));
-                    COMMIT",
+                        TitleLowered      = HYENA_SEARCH_KEY(COALESCE(Title, ?));",
                 ArtistInfo.UnknownArtistName, ArtistInfo.UnknownArtistName,
                 AlbumInfo.UnknownAlbumTitle, ArtistInfo.UnknownArtistName,
                 AlbumInfo.UnknownAlbumTitle, ArtistInfo.UnknownArtistName,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]