I get this error no such table: MEAL (code 1) in the code generated by greendao.
In class i have
@Entity
public class Meal {}
and in generated class
public static final String TABLENAME = "MEAL";
I mention that others class/tables are working and also is the new version of greenDao in which is no need of daoMaster and it is working just with annotations. I cleaned and rebuild, but without succcess. Any ideas?
Thank you and have a good day.
我通过调用此方法解决了这个问题: MealDao.createTable(daoSession.getDatabase(), false);
If you face this situation, probably you need to add migrations for your db. Here is my sample migraitons:
@Override
public void onUpgrade(Database db, int oldVersion, int newVersion) {
super.onUpgrade(db, oldVersion, newVersion);
if (oldVersion < 2) {
Log.d("DEBUG", "DB_OLD_VERSION : " + 1 + ", DB_NEW_VERSION : " + 2);
UserDao.createTable(db, false);
} else if (oldVersion < 3) {
Log.d("DEBUG", "DB_OLD_VERSION : " + 2 + ", DB_NEW_VERSION : " + 3);
} else if (oldVersion < 4) {
Log.d("DEBUG", "DB_OLD_VERSION : " + 3 + ", DB_NEW_VERSION : " + 4);
db.execSQL("ALTER TABLE " + UserDao.TABLENAME + " ADD COLUMN 'uuid' TEXT;");
} else if (oldVersion < 5) {
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.