Fix old database check
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Arsen Musayelyan 2022-12-24 14:03:19 -08:00
parent efca9d116e
commit 3829dc4cc4
2 changed files with 11 additions and 15 deletions

View File

@ -14,15 +14,13 @@ var gdb *sqlx.DB
func init() {
fi, err := os.Stat(config.DBPath)
if err != nil {
log.Fatal("Cannot stat database path").Err(err).Send()
if err == nil {
// TODO: This should be removed by the first stable release.
if fi.IsDir() {
log.Fatal("Your package cache database is using the old database engine. Please remove ~/.cache/lure and then run `lure ref`.").Send()
}
}
// TODO: This should be removed by the first stable release.
if fi.IsDir() {
log.Fatal("Your package cache database is using the old database engine. Please remove ~/.cache/lure and then run `lure ref`.").Send()
}
sqlite.MustRegisterScalarFunction("json_array_contains", 2, db.JsonArrayContains)
gdb, err = sqlx.Open("sqlite", config.DBPath)

12
db.go
View File

@ -14,13 +14,11 @@ var gdb *sqlx.DB
func init() {
fi, err := os.Stat(config.DBPath)
if err != nil {
log.Fatal("Cannot stat database path").Err(err).Send()
}
// TODO: This should be removed by the first stable release.
if fi.IsDir() {
log.Fatal("Your package cache database is using the old database engine. Please remove ~/.cache/lure and then run `lure ref`.").Send()
if err == nil {
// TODO: This should be removed by the first stable release.
if fi.IsDir() {
log.Fatal("Your package cache database is using the old database engine. Please remove ~/.cache/lure and then run `lure ref`.").Send()
}
}
sqlite.MustRegisterScalarFunction("json_array_contains", 2, db.JsonArrayContains)