GreenDao处理数据库降级的时候报 getDatabase called recursively 异常
@Override
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
//错误姿势,这里很容易想到调用this.getWritableDb(), this.getWritableDb() 这样会导致 数据库 onCreate, 然后又onDowngrade, 然后又onCreate ...造成上面的异常
DaoMaster.dropAllTables(this.getWritableDb(), true);
//正确的姿势是下面这种
DaoMaster.dropAllTables(this.wrap(db), true);
DaoMaster.createAllTables(this.wrap(db), true);
}