For some reason, I started getting this error:
Room 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.
I did integrate some changed to the app, but never touched the Room entities.
I exported the database before the changes and after and I noticed that for one of the entities this column
...`created_at` TEXT,...
changed to this
...`created_at` TEXT NOT NULL,...
I never did anything to it. It's not THAT big of a deal, i can do a migration and perhaps solve it, but I'd still want to figure out the root cause of it, and who knows what else might be affected.
What could I have possibly done to make it automatically update the model in that way?
Some things I did in case it helps narrow it down:
- integrated a KMM module to the existing Android project
- updated firebase-crashlytics
- converted project level (not app leve)
build.gradle
to kotlin, sobuild.gradle.kts
- increased
gradle-wrapper.properties
distributionUrl
from6.6.1
to7.3.3
- increased
classpath com.android.tools.build:gradle
from4.0.1
to7.2.2
- increased kotlin version from
1.6.21
to1.8.0
- increased
com.google.gms:google-services
from2.2.1
to2.9.4
In my mind NONE of these things should have affected my database model ... but apparently something did.
Any ideas ?!
EDIT
I just noticed that at some point 2 migrations ago (so not anytime soon), I did this
database.execSQL("ALTER TABLE `GridItem` ADD COLUMN `created_at` TEXT NOT NULL DEFAULT ''");
It seems I did defined it as NOT NULL
, but then ... why would it simply say TEXT
now, when I exported the database, when I in fact defined it as NOT NULL
a while back ?!
This is so confusing !