mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-17 07:30:14 -05:00
move old apg.db to apg_old.db (half measure~)
This commit is contained in:
parent
227155d484
commit
57b264639f
@ -182,10 +182,6 @@ public class KeychainDatabase extends SQLiteOpenHelper {
|
|||||||
if (!db.isReadOnly()) {
|
if (!db.isReadOnly()) {
|
||||||
// Enable foreign key constraints
|
// Enable foreign key constraints
|
||||||
db.execSQL("PRAGMA foreign_keys=ON;");
|
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) {
|
for(String db : dbs) {
|
||||||
if(db.equals("apg.db")) {
|
if(db.equals("apg.db")) {
|
||||||
hasApgDb = true;
|
hasApgDb = true;
|
||||||
break;
|
} else if(db.equals("apg_old.db")) {
|
||||||
|
Log.d(Constants.TAG, "Found apg_old.db");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!hasApgDb || true)
|
if(!hasApgDb)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Log.d(Constants.TAG, "apg.db exists! Importing...");
|
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) {
|
} catch(IOException e) {
|
||||||
Log.e(Constants.TAG, "Error importing apg db!", e);
|
Log.e(Constants.TAG, "Error importing apg.db!", e);
|
||||||
return;
|
|
||||||
} finally {
|
} finally {
|
||||||
if(c != null) {
|
if(c != null) {
|
||||||
c.close();
|
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 {
|
private static void copy(File in, File out) throws IOException {
|
||||||
|
Loading…
Reference in New Issue
Block a user