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) {
2626class DatabaseService {
2727
2828 companion object {
29- const val LATEST_VERSION = 3
29+ const val DB_VERSION = 3
3030 const val DB_FILENAME = " kls_database.db"
3131 }
3232
@@ -42,8 +42,8 @@ class DatabaseService {
4242 DatabaseMetadataEntity .all().firstOrNull()?.version ? : 0
4343 }
4444
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..." )
4747
4848 deleteDb(storagePath)
4949 db = getDbFromFile(storagePath)
@@ -52,10 +52,10 @@ class DatabaseService {
5252 SchemaUtils .createMissingTablesAndColumns(DatabaseMetadata )
5353
5454 DatabaseMetadata .deleteAll()
55- DatabaseMetadata .insert { it[version] = LATEST_VERSION }
55+ DatabaseMetadata .insert { it[version] = DB_VERSION }
5656 }
5757 } 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" )
5959 }
6060 }
6161
You can’t perform that action at this time.
0 commit comments