public static void migrateFrom6To7(SQLiteDatabase db){
  String selectQuery="SELECT * FROM " + DatabaseHelper.TABLE_GRIDITEMRELATIONS;
  Cursor c=db.rawQuery(selectQuery,null);
  if (c.moveToFirst()) {
    do {
      try {
        int gridItemid=c.getInt(c.getColumnIndex(DatabaseHelper.KEY_ID));
        int pluginId=c.getInt(c.getColumnIndex(DatabaseHelper.KEY_GRIDITEMRELATIONS_PLUGIN));
        String pluginpageUrlQuery="SELECT " + DatabaseHelper.KEY_MUNINPLUGINS_PLUGINPAGEURL + " FROM "+ DatabaseHelper.TABLE_MUNINPLUGINS+ " WHERE "+ DatabaseHelper.KEY_ID+ " = "+ pluginId;
        Cursor c2=db.rawQuery(pluginpageUrlQuery,null);
        if (c2.moveToFirst()) {
          String pluginpageUrl=c2.getString(c2.getColumnIndex(DatabaseHelper.KEY_MUNINPLUGINS_PLUGINPAGEURL));
          ContentValues values=new ContentValues();
          values.put(DatabaseHelper.KEY_GRIDITEMRELATIONS_PLUGINPAGEURL,pluginpageUrl);
          db.update(DatabaseHelper.TABLE_GRIDITEMRELATIONS,values,DatabaseHelper.KEY_ID + " = ?",new String[]{String.valueOf(gridItemid)});
        }
        c2.close();
      }
 catch (      Exception ex) {
        ex.printStackTrace();
      }
    }
 while (c.moveToNext());
  }
  c.close();
}

public static void migrateFrom6To7 ( SQLiteDatabase db ) { String selectQuery = "SELECT * FROM " + DatabaseHelper . TABLE_GRIDITEMRELATIONS ; Cursor c = db . rawQuery ( selectQuery , null ) ; if ( c . moveToFirst ( ) ) { do { try { int gridItemid = c . getInt ( c . getColumnIndex ( DatabaseHelper . KEY_ID ) ) ; int pluginId = c . getInt ( c . getColumnIndex ( DatabaseHelper . KEY_GRIDITEMRELATIONS_PLUGIN ) ) ; String pluginpageUrlQuery = "SELECT " + DatabaseHelper . KEY_MUNINPLUGINS_PLUGINPAGEURL + " FROM " + DatabaseHelper . TABLE_MUNINPLUGINS + " WHERE " + DatabaseHelper . KEY_ID + " = " + pluginId ; Cursor c2 = db . rawQuery ( pluginpageUrlQuery , null ) ; if ( c2 . moveToFirst ( ) ) { String pluginpageUrl = c2 . getString ( c2 . getColumnIndex ( DatabaseHelper . KEY_MUNINPLUGINS_PLUGINPAGEURL ) ) ; ContentValues values = new ContentValues ( ) ; values . put ( DatabaseHelper . KEY_GRIDITEMRELATIONS_PLUGINPAGEURL , pluginpageUrl ) ; db . update ( DatabaseHelper . TABLE_GRIDITEMRELATIONS , values , DatabaseHelper . KEY_ID + " = ?" , new String [ ] { String . valueOf ( gridItemid ) } ) ; } c2 . close ( ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; } } while ( c . moveToNext ( ) ) ; } c . close ( ) ; }
from db version 7 , we began to store plugin page url in order to retrieve it whenever the plugin gets deleted . here , we save this information since we don ' t have it in dbs v6 .
