Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data integrity crash #60

Open
nscherer opened this issue May 7, 2019 · 1 comment
Open

Data integrity crash #60

nscherer opened this issue May 7, 2019 · 1 comment

Comments

@nscherer
Copy link

nscherer commented May 7, 2019

ReActiveAndroid Version: 1.4.3

Bug or Feature Request: Got a data integrity crash after updating data model and database version

Description:

java.lang.IllegalStateException: ReActiveAndroid cannot verify the data integrity. Looks like you've changed schema but forgot to update the version number. You can simply fix this by increasing the version number.
        at com.reactiveandroid.internal.database.ReActiveOpenHelper.checkIdentity(ReActiveOpenHelper.java:71)
        at com.reactiveandroid.internal.database.ReActiveOpenHelper.onOpen(ReActiveOpenHelper.java:51)
        at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:411)
        at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:298)
        at com.reactiveandroid.internal.database.DatabaseInfo.getWritableDatabase(DatabaseInfo.java:65)
        at com.reactiveandroid.ReActiveAndroid.getWritableDatabaseForTable(ReActiveAndroid.java:131)
        at com.reactiveandroid.internal.utils.QueryUtils.execSQL(QueryUtils.java:27)
        at com.reactiveandroid.query.ExecutableQueryBase.execute(ExecutableQueryBase.java:21)

I deleted a field from my model, and incremented the database version:

@Database(name = "propertyforce", version = 19)
public class AppDatabase {

It was 18 before. Here's how I'm initializing:

DatabaseConfig appDatabase = new DatabaseConfig.Builder(AppDatabase.class)
                        .addModelClasses(LogEntry.class, FarmReport.class, FarmReportProperty.class)
                        .disableMigrationsChecking() // Potentially destructive, so replace with migrations if adding any tables that need to persist
                        .addTypeSerializers(JsonSerializer.class)
                        .build();
                ReActiveAndroid.init(new ReActiveConfig.Builder(context)
                        .addDatabaseConfigs(appDatabase)
                        .build());

So I shouldn't need any migrations. Why is this happening?

@Rensodiaz
Copy link

Same page here, increasing the version number is not working at all. Thanks for helping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants