I have a table in which I have to add two columns Class and school and I have added it successfully by using migration as
static final Migration MIGRATION_2_3 = new Migration(2, 3) {
@Override
public void migrate(SupportSQLiteDatabase database) {
database.execSQL("ALTER TABLE LearningMaterialChildDetailEntity " + " ADD COLUMN classes TEXT NOT NULL");
database.execSQL("ALTER TABLE LearningMaterialChildDetailEntity " + " ADD COLUMN school TEXT NOT NULL");
}
};
But it gives me exception as
Caused by android.database.sqlite.SQLiteException
Cannot add a NOT NULL column with default value NULL (code 1 SQLITE_ERROR): , while compiling: ALTER TABLE LearningMaterialChildDetailEntity ADD COLUMN classes TEXT NOT NULL
What should I do for solving that exception, either I have to make TEXT NOT NULL to TEXT if yes then how, Please guide me.