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

android.database.sqlite.SQLiteException: Can't downgrade database from version 35 to 33 #42

Closed
hippiefahrzeug opened this issue Jan 20, 2012 · 6 comments

Comments

@hippiefahrzeug
Copy link

In order to upgrade my schema I've created my own SQLiteOpenHelper which does the upgrades at startup. In my last update, something bad happened: Users are reporting this error...

Caused by: android.database.sqlite.SQLiteException: Can't downgrade database from version 35 to 33
at android.database.sqlite.SQLiteOpenHelper.onDowngrade(SQLiteOpenHelper.java:307)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:168)
at org.orman.dbms.sqliteandroid.SQLiteAndroid.(SQLiteAndroid.java:39)
[...]

And indeed, my db version went from 33 to 34. I saw in the orman code the following line:


public class SQLiteAndroid extends SQLiteOpenHelper implements Database {
private static final int SQLITE_VERSION = 33; //TODO read from somewhere else ASAP


... and I'm suspecting that this could be causing the problem.

Right now I'm a bit at a loss here, do you see a possibility for a quick fix?

@ahmetb
Copy link
Owner

ahmetb commented Jan 20, 2012

Ooops that's my bad. Can you please checkout the code, change the line that inludes 33 and run the command rake in your root? (It will require rake and therefore ruby installed, but it is the way to build our jar right now.) Let me know if you have difficulties.

@hippiefahrzeug
Copy link
Author

thank for your quick reply. You're right that will be the fastest way
to fix my problem, I will do that. It would be good if you could add a
constructor with the version number to SQLiteAndroid.

Cheers, and thanks for orman.
Alvi

On Fri, Jan 20, 2012 at 3:00 PM, ahmet alp balkan
reply@reply.github.com
wrote:

Ooops that's my bad. Can you please checkout the code, change the line that inludes 33 and run the command rake in your root? (It will require rake and therefore ruby installed, but it is the way to build our jar right now.) Let me know if you have difficulties.


Reply to this email directly or view it on GitHub:
#42 (comment)

@ahmetb
Copy link
Owner

ahmetb commented Jan 20, 2012

That's a good idea. The reason it is coded that way is because I thought it was about "version of SQLite" rather than the version of the app db. Totally a misconception, sorry about that. Hope you have fixed it for yourself, I'll roll out a fix soon when I have time.

Thanks for reporting the bug.

@hippiefahrzeug
Copy link
Author

It's fine for me now, I added the constructor and built the project without any problems.

@ahmetb
Copy link
Owner

ahmetb commented Jan 20, 2012

Great, feel free to submit a pull request anytime.

@ahmetb ahmetb closed this as completed Jan 20, 2012
ahmetb pushed a commit that referenced this issue Jan 25, 2012
suggested fix for issue #42 reported by @hipplefahrzeug fixed by @Alvi on hardcoded version field of android sqlite wrapper.
@Dodd78
Copy link

Dodd78 commented Jul 3, 2012

may this will be of use to you http://www.enterra-inc.com/techzone/handling_sql_issues/

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

3 participants