question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Table missing column on actual device only

See original GitHub issue

DBFlow Version: 4.0.0-beta-something Issue Kind (Bug, Question, Feature): Question

Description: At some point I added ‘profileID’ column to a table. App works fine in emulator.

On real device, I keep getting this statement error. SQLite table doesn’t seem to have ‘profileID’. But why does this keep happening even after I delete app from device? DB file should be gone, then app will recreate DB when installed next? Here’s the code in generated table code which shows that it should have the column if table creation is executed

  @Override
  public final String getCreationQuery() {
    return "CREATE TABLE IF NOT EXISTS `PhotoMedia`(`uri` TEXT NOT NULL,`dimensions` TEXT NOT NULL,`profileID` TEXT, PRIMARY KEY(`uri`)" + ");";
  }

E/AndroidRuntime: FATAL EXCEPTION: main Process: letstwinkle.com.twinkle, PID: 1786 Theme: themes:{default=overlay:system, iconPack:system, fontPkg:system, com.android.systemui=overlay:system, com.android.systemui.navbar=overlay:system} android.database.sqlite.SQLiteException: table PhotoMedia has no column named profileID (code 1): , while compiling: INSERT INTO PhotoMedia(uri,dimensions,profileID) VALUES (?,?,?) at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889) at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500) at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58) at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31) at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:994) at com.raizlabs.android.dbflow.structure.database.AndroidDatabase.compileStatement(AndroidDatabase.java:59) at com.raizlabs.android.dbflow.structure.ModelAdapter.getInsertStatement(ModelAdapter.java:64) at com.raizlabs.android.dbflow.structure.ModelAdapter.getInsertStatement(ModelAdapter.java:51) at com.raizlabs.android.dbflow.sql.saveable.ModelSaver.save(ModelSaver.java:31) at com.raizlabs.android.dbflow.structure.ModelAdapter.save(ModelAdapter.java:102) at com.raizlabs.android.dbflow.structure.BaseModel.save(BaseModel.java:62) at letstwinkle.com.twinkle.model.UserProfile_Table.save(UserProfile_Table.java:779) at letstwinkle.com.twinkle.model.UserProfile_Table.save(UserProfile_Table.java:35) at letstwinkle.com.twinkle.model.UserProfile.save(UserProfile.kt:137) at letstwinkle.com.twinkle.MyProfileActivity$handleOnCreate$userProfileResponseHandler$1.onResponse(MyProfileActivity.kt:64) at letstwinkle.com.twinkle.MyProfileActivity$handleOnCreate$userProfileResponseHandler$1.onResponse(MyProfileActivity.kt:62) at letstwinkle.com.twinkle.api.AbstractResponseAdapter.onResponse(APIClient.kt:631) at letstwinkle.com.twinkle.api.AbstractResponseAdapter.onResponse(APIClient.kt:626) at letstwinkle.com.twinkle.mock.ServiceMock$MockAsyncTask.onPostExecute(ServiceMock.kt:75) at letstwinkle.com.twinkle.mock.ServiceMock$MockAsyncTask.onPostExecute(ServiceMock.kt:47) at android.os.AsyncTask.finish(AsyncTask.java:651) at android.os.AsyncTask.-wrap1(AsyncTask.java) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5471) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
CapnSpellcheckcommented, Jun 23, 2017

Ah, okay - by ‘roll’ you meant increment basically. Yeah I know to do that, but I’m not sure how the device got stuck this time. I incremented the database version and deployed, but that didn’t help. Anyway, thanks so much for replying, I can’t imagine how much more time I could have wasted before figuring it out!

P.S. You can delete a single app’s data (not the backup) from Settings by navigating to the app and clicking on ‘Storage’. After that you might have to reinstall the app if you don’t have the recovery enabled.

0reactions
CapnSpellcheckcommented, Jul 31, 2017

Sorry for an additional question so much later.

I think root cause was, that there was no migration class defined. Is it currently required (since v4) to define the AlterTableMigration even just for new columns?

Does DBFlow plan to use mingration class for table alters long term? Such classes are wasteful, only running once, but adding to dex 64k limit.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Table has no (public) columns only on real device
I have been facing this issue with message does User have public properties? and it was because User class was missing access modifier....
Read more >
Expression Error Related to missing column on a ta...
Hi Power BI Community, I need your experience and knowledege in order to solve this issue I'm experiencing. Below is the entire code...
Read more >
Avoid refresh errors with missing columns in Power ... - YouTube
Have you refreshed Power BI files and got errors due to missing columns or unwanted columns ? Here I show you how to...
Read more >
Columns missing for On-Prem Event Analytics NOI Extensions
Problem 1DEFAULT_PATTERN_FILTER column is missing from the RELATEDEVENTS ... The only install type for which this field is missing is a Full ...
Read more >
Format an Excel table - Microsoft Support
Custom table styles are only stored in the current workbook, and are not available in other workbooks. ... Select any cell in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found