private List<String> findColumnsToRemove(){
  String tableName=mTableModel.getTableName();
  List<String> removeColumns=new ArrayList<String>();
  List<ColumnModel> columnModelList=mTableModelDB.getColumnModels();
  for (  ColumnModel columnModel : columnModelList) {
    String dbColumnName=columnModel.getColumnName();
    if (isNeedToRemove(dbColumnName)) {
      removeColumns.add(dbColumnName);
    }
  }
  LogUtil.d(TAG,"remove columns from " + tableName + " >> "+ removeColumns);
  return removeColumns;
}

private List < String > findColumnsToRemove ( ) { String tableName = mTableModel . getTableName ( ) ; List < String > removeColumns = new ArrayList < String > ( ) ; List < ColumnModel > columnModelList = mTableModelDB . getColumnModels ( ) ; for ( ColumnModel columnModel : columnModelList ) { String dbColumnName = columnModel . getColumnName ( ) ; if ( isNeedToRemove ( dbColumnName ) ) { removeColumns . add ( dbColumnName ) ; } } LogUtil . d ( TAG , "remove columns from " + tableName + " >> " + removeColumns ) ; return removeColumns ; }
this method helps find the difference between table model from class and table model from database . database should always be synchronized with model class . if there ' re some fields are removed from class , the table model from database will be compared to find out which fields are removed . but there ' re still some exceptions . the columns named id or _id won ' t ever be removed . the foreign key column will be checked some where else , not from here .
