File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
internal/configuration/database Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 44 "errors"
55 "fmt"
66 "net/url"
7+ "os"
78 "strings"
89
910 "github.com/forceu/gokapi/internal/configuration/database/dbabstraction"
@@ -100,10 +101,17 @@ func RunGarbageCollection() {
100101 db .RunGarbageCollection ()
101102}
102103
104+ var osExit = os .Exit
105+
103106// Upgrade migrates the DB to a new Gokapi version, if required
104107func Upgrade () {
105108 dbVersion := db .GetDbVersion ()
106109 expectedVersion := db .GetSchemaVersion ()
110+ if dbVersion > expectedVersion {
111+ fmt .Println ("Error: Database is from a newer Gokapi version. Unable to continue." )
112+ osExit (1 )
113+ return
114+ }
107115 if dbVersion < expectedVersion {
108116 db .Upgrade (dbVersion )
109117 db .SetDbVersion (expectedVersion )
You can’t perform that action at this time.
0 commit comments