private List<String> findIntermediateTablesToDrop(){
  List<String> intermediateTables=new ArrayList<String>();
  for (  String tableName : DBUtility.findAllTableNames(mDb)) {
    if (DBUtility.isIntermediateTable(tableName,mDb)) {
      boolean dropIntermediateTable=true;
      for (      AssociationsModel associationModel : mAssociationModels) {
        if (associationModel.getAssociationType() == Const.Model.MANY_TO_MANY) {
          String intermediateTableName=DBUtility.getIntermediateTableName(associationModel.getTableName(),associationModel.getAssociatedTableName());
          if (tableName.equalsIgnoreCase(intermediateTableName)) {
            dropIntermediateTable=false;
          }
        }
      }
      if (dropIntermediateTable) {
        intermediateTables.add(tableName);
      }
    }
  }
  LogUtil.d(TAG,"findIntermediateTablesToDrop >> " + intermediateTables);
  return intermediateTables;
}

private List < String > findIntermediateTablesToDrop ( ) { List < String > intermediateTables = new ArrayList < String > ( ) ; for ( String tableName : DBUtility . findAllTableNames ( mDb ) ) { if ( DBUtility . isIntermediateTable ( tableName , mDb ) ) { boolean dropIntermediateTable = true ; for ( AssociationsModel associationModel : mAssociationModels ) { if ( associationModel . getAssociationType ( ) == Const . Model . MANY_TO_MANY ) { String intermediateTableName = DBUtility . getIntermediateTableName ( associationModel . getTableName ( ) , associationModel . getAssociatedTableName ( ) ) ; if ( tableName . equalsIgnoreCase ( intermediateTableName ) ) { dropIntermediateTable = false ; } } } if ( dropIntermediateTable ) { intermediateTables . add ( tableName ) ; } } } LogUtil . d ( TAG , "findIntermediateTablesToDrop >> " + intermediateTables ) ; return intermediateTables ; }
when many2many associations are no longer exist between two models , the intermediate join table should be dropped from database . this method helps find out those intermediate join tables which should be dropped cause their associations in classes are done .
