diff options
author | Anderson Mesquita <andersonvom@gmail.com> | 2020-11-02 18:01:32 -0500 |
---|---|---|
committer | Anderson Mesquita <andersonvom@gmail.com> | 2020-11-02 18:01:32 -0500 |
commit | a3a5a936a2c1cc9d9a7b6580be15ed2c19e912f7 (patch) | |
tree | 46d8305078606f07f649bdb612c23b94b0c7f29a /core/src/main | |
parent | b3c69f1a207d45ea61d3df0cc16a6db22bf27fdf (diff) | |
download | AntennaPod-a3a5a936a2c1cc9d9a7b6580be15ed2c19e912f7.zip |
Remove IF NOT EXISTS from index create statements
`onCreate()` should only ever be called once, where the tables and
indices are created. Any other changes need to happen via `onUpgrade()`,
so we can safely remove `IF NOT EXISTS`.
When importing any database into the app (e.g. if it gets corrupted and
is recreated with `sqlite3 old-database.db ".dump"`), it first needs to
be set back to the correct version. This can be done in sqlite with:
$ sqlite3 old-database.db "PRAGMA user_version"
<old-db-version>
$ sqlite3 new-database.db "PRAGMA user_version = <old-db-version>"
For more context, see this PR:
https://github.com/AntennaPod/AntennaPod/pull/4585
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java index 935b06cd6..539bedd9f 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java @@ -195,11 +195,11 @@ public class PodDBAdapter { + TABLE_NAME_FEED_ITEMS + "_" + KEY_FEED + " ON " + TABLE_NAME_FEED_ITEMS + " (" + KEY_FEED + ")"; - static final String CREATE_INDEX_FEEDITEMS_PUBDATE = "CREATE INDEX IF NOT EXISTS " + static final String CREATE_INDEX_FEEDITEMS_PUBDATE = "CREATE INDEX " + TABLE_NAME_FEED_ITEMS + "_" + KEY_PUBDATE + " ON " + TABLE_NAME_FEED_ITEMS + " (" + KEY_PUBDATE + ")"; - static final String CREATE_INDEX_FEEDITEMS_READ = "CREATE INDEX IF NOT EXISTS " + static final String CREATE_INDEX_FEEDITEMS_READ = "CREATE INDEX " + TABLE_NAME_FEED_ITEMS + "_" + KEY_READ + " ON " + TABLE_NAME_FEED_ITEMS + " (" + KEY_READ + ")"; |