aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r--src/org/traccar/database/DataManager.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index 4c12ecd77..3cfeadae4 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -38,6 +38,7 @@ import org.traccar.model.Device;
import org.traccar.model.MiscFormatter;
import org.traccar.model.Permission;
import org.traccar.model.Position;
+import org.traccar.model.Schema;
import org.traccar.model.Server;
import org.traccar.model.User;
import org.traccar.web.AsyncServlet;
@@ -157,6 +158,23 @@ public class DataManager implements IdentityManager {
}
}
if (exist) {
+
+ String schemaVersionQuery = getQuery("database.selectSchemaVersion");
+ if (schemaVersionQuery != null) {
+
+ Schema schema = QueryBuilder.create(dataSource, schemaVersionQuery).executeQuerySingle(new Schema());
+
+ int version = 0;
+ if (schema != null) {
+ version = schema.getVersion();
+ }
+
+ if (version != 301) {
+ Log.error("Wrong database schema version (" + version + ")");
+ throw new RuntimeException();
+ }
+ }
+
return;
}