+
+ // Upgrade from schema version 2.
+ case 2:
+ // Once the SQLite version is >= 3.25.0 `ALTER TABLE RENAME COLUMN` can be used. https://www.sqlite.org/lang_altertable.html https://www.sqlite.org/changes.html
+ // https://developer.android.com/reference/android/database/sqlite/package-summary
+ // In the meantime, a new column must be created with the new name. There is no need to delete the old column on the temporary import database.
+
+ // Get a cursor with the current `default_font_size` value.
+ Cursor importDatabasePreferenceCursor = importDatabase.rawQuery("SELECT default_font_size FROM " + PREFERENCES_TABLE, null);
+
+ // Move to the beginning fo the cursor.
+ importDatabasePreferenceCursor.moveToFirst();
+
+ // Get the current value in `default_font_size`.
+ String fontSize = importDatabasePreferenceCursor.getString(importDatabasePreferenceCursor.getColumnIndex("default_font_size"));
+
+ // Close the cursor.
+ importDatabasePreferenceCursor.close();
+
+ // Create a new column named `font_size`.
+ importDatabase.execSQL("ALTER TABLE " + PREFERENCES_TABLE + " ADD COLUMN " + FONT_SIZE + " TEXT");
+
+ // Place the font size string in the new column.
+ importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + FONT_SIZE + " = " + fontSize);
+
+ case 3:
+ // Add the Pinned IP Addresses columns.
+ importDatabase.execSQL("ALTER TABLE " + DomainsDatabaseHelper.DOMAINS_TABLE + " ADD COLUMN " + DomainsDatabaseHelper.PINNED_IP_ADDRESSES + " BOOLEAN");
+ importDatabase.execSQL("ALTER TABLE " + DomainsDatabaseHelper.DOMAINS_TABLE + " ADD COLUMN " + DomainsDatabaseHelper.IP_ADDRESSES + " TEXT");