diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2014-04-11 20:39:36 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2014-04-14 13:06:49 +0200 |
commit | 57b264639ff209b2ed44aa8085cddd9393b7b50f (patch) | |
tree | a3a250ae7980b17cd941cd9c4fa7b4659dea3aee /OpenKeychain/src/main/java/org/sufficientlysecure/keychain | |
parent | 227155d484766a620a2f9467a248c844fca26382 (diff) | |
download | open-keychain-57b264639ff209b2ed44aa8085cddd9393b7b50f.tar.gz open-keychain-57b264639ff209b2ed44aa8085cddd9393b7b50f.tar.bz2 open-keychain-57b264639ff209b2ed44aa8085cddd9393b7b50f.zip |
move old apg.db to apg_old.db (half measure~)
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainDatabase.java | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainDatabase.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainDatabase.java index 80fa914b2..abbf3dc13 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainDatabase.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainDatabase.java @@ -182,10 +182,6 @@ public class KeychainDatabase extends SQLiteOpenHelper { if (!db.isReadOnly()) { // Enable foreign key constraints db.execSQL("PRAGMA foreign_keys=ON;"); - // TODO remove, once we remove the "always migrate" debug stuff - // db.execSQL("DROP TABLE user_ids;"); - db.execSQL(CREATE_USER_IDS); - db.execSQL(CREATE_CERTS); } } @@ -208,12 +204,13 @@ public class KeychainDatabase extends SQLiteOpenHelper { for(String db : dbs) { if(db.equals("apg.db")) { hasApgDb = true; - break; + } else if(db.equals("apg_old.db")) { + Log.d(Constants.TAG, "Found apg_old.db"); } } } - if(!hasApgDb || true) + if(!hasApgDb) return; Log.d(Constants.TAG, "apg.db exists! Importing..."); @@ -286,9 +283,12 @@ public class KeychainDatabase extends SQLiteOpenHelper { } } + // Move to a different file (but don't delete, just to be safe) + Log.d(Constants.TAG, "All done - moving apg.db to apg_old.db"); + context.getDatabasePath("apg.db").renameTo(context.getDatabasePath("apg_old.db")); + } catch(IOException e) { - Log.e(Constants.TAG, "Error importing apg db!", e); - return; + Log.e(Constants.TAG, "Error importing apg.db!", e); } finally { if(c != null) { c.close(); @@ -298,10 +298,6 @@ public class KeychainDatabase extends SQLiteOpenHelper { } } - // TODO delete old db, if we are sure this works - // context.deleteDatabase("apg.db"); - Log.d(Constants.TAG, "All done, (not) deleting apg.db"); - } private static void copy(File in, File out) throws IOException { |