mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-01 17:38:33 +00:00
Add sqlite build tag
This adds a sqlite build tag so that you don't have to have the sqlite import commented out in code and users can run: go build -tags sqlite if they want to have sqlite support enabled. It is disabled by default so nothing changes with the default go get or build commands.
This commit is contained in:
parent
0650c3c9f6
commit
25fd495b2e
2 changed files with 14 additions and 4 deletions
|
@ -12,7 +12,6 @@ import (
|
|||
_ "github.com/go-sql-driver/mysql"
|
||||
_ "github.com/lib/pq"
|
||||
"github.com/lunny/xorm"
|
||||
// _ "github.com/mattn/go-sqlite3"
|
||||
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
)
|
||||
|
@ -56,9 +55,9 @@ func NewTestEngine(x *xorm.Engine) (err error) {
|
|||
case "postgres":
|
||||
x, err = xorm.NewEngine("postgres", fmt.Sprintf("user=%s password=%s dbname=%s sslmode=%s",
|
||||
DbCfg.User, DbCfg.Pwd, DbCfg.Name, DbCfg.SslMode))
|
||||
// case "sqlite3":
|
||||
// os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm)
|
||||
// x, err = xorm.NewEngine("sqlite3", DbCfg.Path)
|
||||
case "sqlite3":
|
||||
os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm)
|
||||
x, err = xorm.NewEngine("sqlite3", DbCfg.Path)
|
||||
default:
|
||||
return fmt.Errorf("Unknown database type: %s", DbCfg.Type)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue