-
Notifications
You must be signed in to change notification settings - Fork 23
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
Initial database access fails; migration not properly handled due to difference in Indices #7
Comments
the error is that there is a difference between your Database file and Room Dao |
Yes - at first the problem was I couldn't see the error since the message was cut off. Now, the problem is that the error is involving Indices, which I thought I found the fix for but doesn't seem to be working. I added the following lines in my SQL generation code after creating the table 'Assist' (which is the one being picked up first by the runtime error):
and when I use a separate program to browse the SQLite database, the indices show up. But the error message from Room/RoomAsset in Android Studio still shows |
I will look into it and help you solve the problem in 24 hours max, but I'm going to sleep now :D |
okay, from what I can see my best guess that the problem is the name difference: |
So in the DAO, The problem is Room (in this case RoomAsset, since this is not a problem that would ever come up using Room normally) is not recognizing any of the indices specified in the original SQLite database. Hence the If I had to guess, it may have something to do with the fact that indices in SQLite are not actually "attached" to a specific table, they are in their own space within the SQLite database and simply reference what table they apply to. In my case, I believe can fix my issue by simply doing away with the However, this could be an issue for people who need those I think I will go with the solution I mentioned for my particular case, so if you want you can close this issue. But as I mentioned, I think it's worthy of getting to the bottom of in the case of more complex use cases. So I'm not personally going to close this yet. |
thank you for the explaining. I will leave this issue open until a solution is found. |
I have the same problem - is anything happened according to this issue in the last 2 years? I have a new Entity with an index created by the entity annotation. I try to reach this by an migration sql statement (CREATE INDEX index_< table >_< column > ON < table > (< column >)). A test with SELECT type, name, tbl_name, sql FROM sqlite_master WHERE type= 'index'; successfully shows me the index as well as an other index of my database. Any ideas how to fix this? |
In the same vein as a couple of the other issues, I'm encountering a runtime error when attempting to open my database for the first time. However, my issue is that despite my own SQL-created database and my Room-generated database appearing to perfectly coincide, I get an error saying migration was not properly handled. And the problem is, I have no idea what the difference is because the "Found:" line in the error message is truncated part of the way through. I'm unsure if this is an actual real issue with the database representation being broken, or simply an issue with the error message for some reason.
Here's what I see:
Any ideas?
For reference, the relevant portion of my SQL database generation:
and my Room entity class:
EDIT -- Running on a different virtual device (Pixel 2 API 26, was running Nexus 6 API 23) gives me the full error message. Here's what it shows now:
So the difference is in the indices. However, Room needs those indices to work properly. How do I make equivalents via SQL?
The text was updated successfully, but these errors were encountered: