mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 03:27:39 +08:00
fix: change db dir
This commit is contained in:
4
db/db.go
4
db/db.go
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"polaris/ent"
|
"polaris/ent"
|
||||||
"polaris/ent/downloadclients"
|
"polaris/ent/downloadclients"
|
||||||
"polaris/ent/history"
|
"polaris/ent/history"
|
||||||
@@ -26,7 +27,8 @@ type Client struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Open() (*Client, error) {
|
func Open() (*Client, error) {
|
||||||
client, err := ent.Open(dialect.SQLite, "file:polaris.db?cache=shared&_fk=1")
|
os.Mkdir("./db", 0666)
|
||||||
|
client, err := ent.Open(dialect.SQLite, "file:./db/polaris.db?cache=shared&_fk=1")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "failed opening connection to sqlite")
|
return nil, errors.Wrap(err, "failed opening connection to sqlite")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user