Commit c3c27a21 authored by Daniel Wolf's avatar Daniel Wolf

The beta was on version 4

parent fb25df80
Subproject commit ded00d8d84c6265e2f5439690aab244d9e8e133f
Subproject commit fd07ee7992e685e805b8752ffee26f0e9c09bdf5
......@@ -43,7 +43,7 @@ import java.util.Set;
*/
public class DatabaseHelper extends com.frostnerd.utils.database.DatabaseHelper {
public static final String DATABASE_NAME = "data";
public static final int DATABASE_VERSION = 3;
public static final int DATABASE_VERSION = 5;
@NonNull
public static final Set<Class<? extends Entity>> entities = new HashSet<Class<? extends Entity>>(){{
add(DNSEntry.class);
......@@ -81,6 +81,11 @@ public class DatabaseHelper extends com.frostnerd.utils.database.DatabaseHelper
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if(oldVersion != 4 && oldVersion != 3) super.onUpgrade(db, oldVersion, newVersion);
}
@Override
public void onBeforeUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if(oldVersion <= 1){
......@@ -140,11 +145,13 @@ public class DatabaseHelper extends com.frostnerd.utils.database.DatabaseHelper
@Override
public void onAfterUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
int version;
for(DNSEntry entry: DNSEntry.defaultDNSEntries.keySet()){
version = DNSEntry.defaultDNSEntries.get(entry);
if(getCount(DNSEntry.class, WhereCondition.equal("name", entry.getName())) == 0)
if(version > oldVersion && version <= newVersion)insert(entry);
if(oldVersion != 4) {
int version;
for(DNSEntry entry: DNSEntry.defaultDNSEntries.keySet()){
version = DNSEntry.defaultDNSEntries.get(entry);
if(getCount(DNSEntry.class, WhereCondition.equal("name", entry.getName())) == 0)
if(version > oldVersion && version <= newVersion)insert(entry);
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment