Banshee.Database.BansheeDbFormatMigrator.Migrate_31 C# (CSharp) Method

Migrate_31() private method

private Migrate_31 ( ) : bool
return bool
        private bool Migrate_31 ()
        {
            try {
                // Make paths not relative for Music Library items
                string library_path = Banshee.Library.LibrarySource.OldLocationSchema.Get (Banshee.Library.MusicLibrarySource.GetDefaultBaseDirectory ());
                if (library_path != null) {
                    connection.AddFunction<MigratePartialFunction> ();

                    int podcast_src_id = connection.Query<int> ("SELECT PrimarySourceID FROM CorePrimarySources WHERE StringID = 'PodcastSource-PodcastLibrary'");

                    connection.Execute (@"
                        UPDATE CoreTracks SET Uri = BANSHEE_MIGRATE_PARTIAL(?, Uri)
                        WHERE UriType = 1
                          AND PrimarySourceID != ?", library_path, podcast_src_id);

                    string podcast_path = Paths.Combine (library_path, "Podcasts");
                    connection.Execute (@"
                        UPDATE CoreTracks SET Uri = BANSHEE_MIGRATE_PARTIAL(?, Uri)
                        WHERE UriType = 1
                          AND PrimarySourceID = ?", podcast_path, podcast_src_id);

                    connection.RemoveFunction<MigratePartialFunction> ();
                }
            } catch (Exception e) {
                Hyena.Log.Exception (e);
            }
            return true;
        }