fixed issues with first-time setup, added config.db.port

This commit is contained in:
ari melody 2025-01-21 14:12:21 +00:00
parent 7bea6b548e
commit 3d674515ce
Signed by: ari
GPG key ID: CF99829C92678188
4 changed files with 26 additions and 12 deletions

View file

@ -20,9 +20,13 @@ func CheckDBVersionAndMigrate(db *sqlx.DB) {
)
oldDBVersion := 0
err := db.Get(&oldDBVersion, "SELECT MAX(version) FROM schema_version")
schemaVersionCount := 0
err := db.Get(&schemaVersionCount, "SELECT COUNT(*) FROM schema_version")
if err != nil { panic(err) }
if schemaVersionCount > 0 {
err := db.Get(&oldDBVersion, "SELECT MAX(version) FROM schema_version")
if err != nil { panic(err) }
}
for oldDBVersion < DB_VERSION {
switch oldDBVersion {