Add version package and update the makefile
The makefile will grab the version info from git and pass it to the linker so that version information based on tags, commits and commit times is available in the code.
This commit is contained in:
@ -14,9 +14,9 @@ import (
|
||||
"strconv"
|
||||
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
)
|
||||
|
||||
const expectedSchemaVersion = 1
|
||||
"git.omicron.one/omicron/linkshare/internal/version"
|
||||
)
|
||||
|
||||
// DB represents a database connection
|
||||
type DB struct {
|
||||
@ -123,13 +123,13 @@ func (db *DB) CheckSchemaVersion() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
version, err := db.GetSchemaVersion()
|
||||
version_, err := db.GetSchemaVersion()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if version < expectedSchemaVersion {
|
||||
if version_ < version.SchemaVersion {
|
||||
return ErrDatabaseSchemaOutdated
|
||||
} else if version > expectedSchemaVersion {
|
||||
} else if version_ > version.SchemaVersion {
|
||||
return ErrDatabaseSchemaUnsupported
|
||||
}
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user