Fix old database check
This commit is contained in:
parent
70e68fbf9a
commit
5b5cee4343
|
@ -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
12
db.go
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue