Fixed bug in creation of database after adding keep_in_sync column

This commit is contained in:
David A. Velasco 2012-07-09 09:23:42 +02:00
parent f2a79ec8fd
commit 15a2d8b8e6
2 changed files with 6 additions and 3 deletions

View file

@ -18,7 +18,7 @@
-->
<manifest package="eu.alefzero.owncloud"
android:versionCode="1"
android:versionName="0.1.149B" xmlns:android="http://schemas.android.com/apk/res/android">
android:versionName="0.1.150B" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />

View file

@ -203,6 +203,7 @@ public class FileContentProvider extends ContentProvider {
@Override
public void onCreate(SQLiteDatabase db) {
// files table
Log.i("SQL", "Entering in onCreate");
db.execSQL("CREATE TABLE " + ProviderTableMeta.DB_NAME + "("
+ ProviderTableMeta._ID + " INTEGER PRIMARY KEY, "
+ ProviderTableMeta.FILE_NAME + " TEXT, "
@ -214,17 +215,19 @@ public class FileContentProvider extends ContentProvider {
+ ProviderTableMeta.FILE_CONTENT_LENGTH + " INTEGER, "
+ ProviderTableMeta.FILE_STORAGE_PATH + " TEXT, "
+ ProviderTableMeta.FILE_ACCOUNT_OWNER + " TEXT, "
+ ProviderTableMeta.FILE_LAST_SYNC_DATE + " INTEGER "
+ ProviderTableMeta.FILE_LAST_SYNC_DATE + " INTEGER, "
+ ProviderTableMeta.FILE_KEEP_IN_SYNC + " INTEGER );");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.i("SQL", "Entering in onUpgrade");
if (oldVersion == 1 && newVersion >= 2) {
Log.i("SQL", "Entering in the ADD in onUpgrade");
db.execSQL("ALTER TABLE " + ProviderTableMeta.DB_NAME +
" ADD COLUMN " + ProviderTableMeta.FILE_KEEP_IN_SYNC + " INTEGER " +
" DEFAULT 0");
}
} else Log.i("SQL", "OUT of the ADD in onUpgrade; oldVersion == " + oldVersion + ", newVersion == " + newVersion);
}
}