Bug 708149 - Factor out method to migrate bookmarks table (r=rnewman)
authorLucas Rocha <lucasr@mozilla.com>
Tue, 20 Mar 2012 11:44:31 +0000
changeset 91939 7d910d51187ef97c63206419fa372b59b6b0d82b
parent 91938 499d5cbefc30201b3111d87d96cd26950ad88fec
child 91940 56b4f77bbc10f12315b92d2f30bf4a8cef8189ad
push idunknown
push userunknown
push dateunknown
reviewersrnewman
bugs708149
milestone13.0a2
Bug 708149 - Factor out method to migrate bookmarks table (r=rnewman)
mobile/android/base/db/BrowserProvider.java.in
--- a/mobile/android/base/db/BrowserProvider.java.in
+++ b/mobile/android/base/db/BrowserProvider.java.in
@@ -480,17 +480,17 @@ public class BrowserProvider extends Con
 
             final int nSubFolders = subFolders.size();
             for (int i = 0; i < nSubFolders; i++) {
                 int subFolderId = subFolders.get(i);
                 migrateBookmarkFolder(db, subFolderId);
             }
         }
 
-        private void upgradeDatabaseFrom1to2(SQLiteDatabase db) {
+        private void migrateBookmarksTable(SQLiteDatabase db) {
             debug("Renaming bookmarks table to " + TABLE_BOOKMARKS_TMP);
             db.execSQL("ALTER TABLE " + TABLE_BOOKMARKS +
                        " RENAME TO " + TABLE_BOOKMARKS_TMP);
 
             debug("Dropping views and indexes related to " + TABLE_BOOKMARKS);
             db.execSQL("DROP VIEW IF EXISTS " + VIEW_BOOKMARKS_WITH_IMAGES);
 
             db.execSQL("DROP INDEX IF EXISTS bookmarks_url_index");
@@ -508,16 +508,20 @@ public class BrowserProvider extends Con
             // Ensure all special folders exist and have the
             // right folder hierarchy.
             createOrUpdateAllSpecialFolders(db);
 
             debug("Dropping bookmarks temporary table");
             db.execSQL("DROP TABLE IF EXISTS " + TABLE_BOOKMARKS_TMP);
         }
 
+        private void upgradeDatabaseFrom1to2(SQLiteDatabase db) {
+            migrateBookmarksTable(db);
+        }
+
         private void upgradeDatabaseFrom2to3(SQLiteDatabase db) {
             debug("Dropping view: " + VIEW_BOOKMARKS_WITH_IMAGES);
             db.execSQL("DROP VIEW IF EXISTS " + VIEW_BOOKMARKS_WITH_IMAGES);
 
             createBookmarksWithImagesView(db);
 
             debug("Dropping view: " + VIEW_HISTORY_WITH_IMAGES);
             db.execSQL("DROP VIEW IF EXISTS " + VIEW_HISTORY_WITH_IMAGES);