Mirror fix on sqlite3 tag

tokarchuk/v1.17
Unknown 11 years ago
parent d60f7b85e5
commit 23bba7633b
  1. 6
      models/models.go
  2. 8
      models/models_sqlite.go

@ -26,7 +26,8 @@ var (
Type, Host, Name, User, Pwd, Path, SslMode string Type, Host, Name, User, Pwd, Path, SslMode string
} }
UseSQLite3 bool EnableSQLite3 bool
UseSQLite3 bool
) )
func init() { func init() {
@ -56,6 +57,9 @@ func NewTestEngine(x *xorm.Engine) (err error) {
x, err = xorm.NewEngine("postgres", fmt.Sprintf("user=%s password=%s dbname=%s sslmode=%s", x, err = xorm.NewEngine("postgres", fmt.Sprintf("user=%s password=%s dbname=%s sslmode=%s",
DbCfg.User, DbCfg.Pwd, DbCfg.Name, DbCfg.SslMode)) DbCfg.User, DbCfg.Pwd, DbCfg.Name, DbCfg.SslMode))
case "sqlite3": case "sqlite3":
if !EnableSQLite3 {
return fmt.Errorf("Unknown database type: %s", DbCfg.Type)
}
os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm) os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm)
x, err = xorm.NewEngine("sqlite3", DbCfg.Path) x, err = xorm.NewEngine("sqlite3", DbCfg.Path)
default: default:

@ -1,11 +1,15 @@
// +build sqlite
// Copyright 2014 The Gogs Authors. All rights reserved. // Copyright 2014 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style // Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build sqlite
package models package models
import ( import (
_ "github.com/mattn/go-sqlite3" _ "github.com/mattn/go-sqlite3"
) )
func init() {
EnableSQLite3 = true
}

Loading…
Cancel
Save