Skip to content

Commit 23bba76

Browse files
committed
Mirror fix on sqlite3 tag
1 parent d60f7b8 commit 23bba76

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

models/models.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ var (
2626
Type, Host, Name, User, Pwd, Path, SslMode string
2727
}
2828

29-
UseSQLite3 bool
29+
EnableSQLite3 bool
30+
UseSQLite3 bool
3031
)
3132

3233
func init() {
@@ -56,6 +57,9 @@ func NewTestEngine(x *xorm.Engine) (err error) {
5657
x, err = xorm.NewEngine("postgres", fmt.Sprintf("user=%s password=%s dbname=%s sslmode=%s",
5758
DbCfg.User, DbCfg.Pwd, DbCfg.Name, DbCfg.SslMode))
5859
case "sqlite3":
60+
if !EnableSQLite3 {
61+
return fmt.Errorf("Unknown database type: %s", DbCfg.Type)
62+
}
5963
os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm)
6064
x, err = xorm.NewEngine("sqlite3", DbCfg.Path)
6165
default:

models/models_sqlite.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
// +build sqlite
2-
31
// Copyright 2014 The Gogs Authors. All rights reserved.
42
// Use of this source code is governed by a MIT-style
53
// license that can be found in the LICENSE file.
64

5+
// +build sqlite
6+
77
package models
88

99
import (
1010
_ "github.com/mattn/go-sqlite3"
1111
)
12+
13+
func init() {
14+
EnableSQLite3 = true
15+
}

0 commit comments

Comments
 (0)