浏览代码

fix failing upgrade on very old version

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Tobias Kaminsky 6 年之前
父节点
当前提交
6f9ac654c5
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      src/main/java/com/owncloud/android/providers/FileContentProvider.java

+ 5 - 3
src/main/java/com/owncloud/android/providers/FileContentProvider.java

@@ -1757,9 +1757,11 @@ public class FileContentProvider extends ContentProvider {
                 Log_OC.i(SQL, "Entering in the #34 add redirect to external links");
                 db.beginTransaction();
                 try {
-                    db.execSQL(ALTER_TABLE + ProviderTableMeta.EXTERNAL_LINKS_TABLE_NAME +
-                            ADD_COLUMN + ProviderTableMeta.EXTERNAL_LINKS_REDIRECT + " INTEGER "); // boolean
-
+                    if (!checkIfColumnExists(db, ProviderTableMeta.EXTERNAL_LINKS_TABLE_NAME,
+                                             ProviderTableMeta.EXTERNAL_LINKS_REDIRECT)) {
+                        db.execSQL(ALTER_TABLE + ProviderTableMeta.EXTERNAL_LINKS_TABLE_NAME +
+                                       ADD_COLUMN + ProviderTableMeta.EXTERNAL_LINKS_REDIRECT + " INTEGER "); // boolean
+                    }
                     upgraded = true;
                     db.setTransactionSuccessful();
                 } finally {