File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
shared/src/main/kotlin/org/javacs/kt/database Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class DatabaseMetadataEntity(id: EntityID<Int>) : IntEntity(id) {
26
26
class DatabaseService {
27
27
28
28
companion object {
29
- const val LATEST_VERSION = 3
29
+ const val DB_VERSION = 3
30
30
const val DB_FILENAME = " kls_database.db"
31
31
}
32
32
@@ -42,8 +42,8 @@ class DatabaseService {
42
42
DatabaseMetadataEntity .all().firstOrNull()?.version ? : 0
43
43
}
44
44
45
- if (currentVersion < LATEST_VERSION ) {
46
- LOG .info(" Database has outdated version $currentVersion < $LATEST_VERSION and will be rebuilt..." )
45
+ if (currentVersion != DB_VERSION ) {
46
+ LOG .info(" Database has version $currentVersion != $DB_VERSION (the required version), therefore it will be rebuilt..." )
47
47
48
48
deleteDb(storagePath)
49
49
db = getDbFromFile(storagePath)
@@ -52,10 +52,10 @@ class DatabaseService {
52
52
SchemaUtils .createMissingTablesAndColumns(DatabaseMetadata )
53
53
54
54
DatabaseMetadata .deleteAll()
55
- DatabaseMetadata .insert { it[version] = LATEST_VERSION }
55
+ DatabaseMetadata .insert { it[version] = DB_VERSION }
56
56
}
57
57
} else {
58
- LOG .info(" Database has latest version $currentVersion and will be used as-is" )
58
+ LOG .info(" Database has the correct version $currentVersion and will be used as-is" )
59
59
}
60
60
}
61
61
You can’t perform that action at this time.
0 commit comments