[Android] MediaDatabase: add incremental upgrades

Edward Wang git at videolan.org
Mon Dec 8 09:41:55 CET 2014


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Thu Jul 10 17:09:25 2014 -0400| [1bb0f0bee06b9c402fc506da978847158e65a6b5] | committer: Edward Wang

MediaDatabase: add incremental upgrades

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=1bb0f0bee06b9c402fc506da978847158e65a6b5
---

 vlc-android/src/org/videolan/vlc/MediaDatabase.java |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/MediaDatabase.java b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
index 850b825..4465028 100644
--- a/vlc-android/src/org/videolan/vlc/MediaDatabase.java
+++ b/vlc-android/src/org/videolan/vlc/MediaDatabase.java
@@ -223,6 +223,19 @@ public class MediaDatabase {
                 dropMediaTableQuery(db);
                 createMediaTableQuery(db);
             }
+            // Upgrade incrementally from oldVersion to newVersion
+            for(int i = oldVersion+1; i <= newVersion; i++) {
+                switch(i) {
+                case 9:
+                    // Remodelled playlist tables: re-create them
+                    db.execSQL("DROP TABLE " + PLAYLIST_MEDIA_TABLE_NAME + ";");
+                    db.execSQL("DROP TABLE " + PLAYLIST_TABLE_NAME + ";");
+                    createPlaylistTablesQuery(db);
+                    break;
+                default:
+                    break;
+                }
+            }
         }
     }
 



More information about the Android mailing list