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:
1 parent
6998a0fa0a
commit
9f28796e8a
3 files changed
+32
-6
No files matched your search
@@ -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