db.commit();
db.shutdown();
}
private static Database dbMigrate() throws IllegalAccessException, SQLException, ClassNotFoundException, InstantiationException {
Table schemaInfo = new Table("schema_info");
List<Record> info = schemaInfo.findAll();
if(info != null) {
Record first = info.get(0);
HashBacked record = new HashBacked(first);
int version = record.getInteger("version", -1);
if(version != -1) {
int last_version = version;
version++;
NumberFormat nf = NumberFormat.getIntegerInstance();
nf.setMinimumIntegerDigits(3);
Statement s = schemaInfo.getDB().getStatement();
while(runFile(schemaInfo.getDB(), s, "/db/" + nf.format(version) + ".sql")) {
record.setInteger("version", version);
schemaInfo.updateMap("schema_info", "version", Integer.toString(last_version), record.getBacking());
last_version = version;
version++;
}
}
}
return schemaInfo.getDB();
}