diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2015-01-08 13:12:45 +0100 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2015-01-08 13:12:45 +0100 |
commit | 389e1accdd1b753372a03d80b9ad9da3cd54aec4 (patch) | |
tree | dadad19ec5c5d4128069e064e3221db39ad2d58b /app/src/main/java/de | |
parent | 9ece3a7db4949455cbaf0127e3eea3c4c739f9b1 (diff) | |
download | AntennaPod-389e1accdd1b753372a03d80b9ad9da3cd54aec4.zip |
Bugfix: Chapters were saved multiple times
Diffstat (limited to 'app/src/main/java/de')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/config/StorageCallbacksImpl.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/config/StorageCallbacksImpl.java b/app/src/main/java/de/danoeh/antennapod/config/StorageCallbacksImpl.java index ebb3780b7..10a3c1b32 100644 --- a/app/src/main/java/de/danoeh/antennapod/config/StorageCallbacksImpl.java +++ b/app/src/main/java/de/danoeh/antennapod/config/StorageCallbacksImpl.java @@ -13,7 +13,7 @@ public class StorageCallbacksImpl implements StorageCallbacks { @Override public int getDatabaseVersion() { - return 13; + return 14; } @Override @@ -105,9 +105,24 @@ public class StorageCallbacksImpl implements StorageCallbacks { } if (oldVersion <= 12) { db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS - + " ADD COLUMN " + PodDBAdapter.KEY_IS_PAGED + " INTEGER DEFAULT 0"); + + " ADD COLUMN " + PodDBAdapter.KEY_IS_PAGED + " INTEGER DEFAULT 0"); db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS + " ADD COLUMN " + PodDBAdapter.KEY_NEXT_PAGE_LINK + " TEXT"); } + if (oldVersion <= 13) { + // remove duplicate rows in "Chapters" table that were created because of a bug. + db.execSQL(String.format("DELETE FROM %s WHERE %s NOT IN " + + "(SELECT MIN(%s) as %s FROM %s GROUP BY %s,%s,%s,%s,%s)", + PodDBAdapter.TABLE_NAME_SIMPLECHAPTERS, + PodDBAdapter.KEY_ID, + PodDBAdapter.KEY_ID, + PodDBAdapter.KEY_ID, + PodDBAdapter.TABLE_NAME_SIMPLECHAPTERS, + PodDBAdapter.KEY_TITLE, + PodDBAdapter.KEY_START, + PodDBAdapter.KEY_FEEDITEM, + PodDBAdapter.KEY_LINK, + PodDBAdapter.KEY_CHAPTER_TYPE)); + } } } |