diff options
-rw-r--r-- | core/src/ch/asynk/rustanddust/util/DB.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/core/src/ch/asynk/rustanddust/util/DB.java b/core/src/ch/asynk/rustanddust/util/DB.java index b733cc0..2e108ca 100644 --- a/core/src/ch/asynk/rustanddust/util/DB.java +++ b/core/src/ch/asynk/rustanddust/util/DB.java @@ -79,8 +79,10 @@ public class DB Boolean version = checkVersion(); if(version == null) createTables(); - else if (version == false) - System.err.println("TODO update schema"); + else if (version == false) { + dropTables(); + createTables(); + } } private void createTables() @@ -97,6 +99,18 @@ public class DB } } + private void dropTables() + { + try { + exec("drop table if exists turns"); + exec("drop table if exists states"); + exec("drop table if exists games"); + exec(String.format("update config set value=%d where key='version';", DB_SCHEMA_VERSION)); + } catch (SQLiteGdxException e) { + RustAndDust.error("table creation error " + e.getMessage()); + } + } + private String getDigest(String str) { String hash = null; |