]> source.dussan.org Git - gitea.git/commitdiff
Mirror fix on sqlite3 tag
authorUnknown <joe2010xtmf@163.com>
Sat, 12 Apr 2014 20:24:09 +0000 (16:24 -0400)
committerUnknown <joe2010xtmf@163.com>
Sat, 12 Apr 2014 20:24:09 +0000 (16:24 -0400)
models/models.go
models/models_sqlite.go

index 010228aed30742a376d14347447c41c91678e7ea..b8374a3d67009181988d6d71fa269264e59cafa9 100644 (file)
@@ -26,7 +26,8 @@ var (
                Type, Host, Name, User, Pwd, Path, SslMode string
        }
 
-       UseSQLite3 bool
+       EnableSQLite3 bool
+       UseSQLite3    bool
 )
 
 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",
                        DbCfg.User, DbCfg.Pwd, DbCfg.Name, DbCfg.SslMode))
        case "sqlite3":
+               if !EnableSQLite3 {
+                       return fmt.Errorf("Unknown database type: %s", DbCfg.Type)
+               }
                os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm)
                x, err = xorm.NewEngine("sqlite3", DbCfg.Path)
        default:
index 02c3f58249e6e1610e1249331cfb45772bc64dfd..1d80823fe5f48680dcd698bfbd7c96df59b656cd 100644 (file)
@@ -1,11 +1,15 @@
-// +build sqlite
-
 // Copyright 2014 The Gogs Authors. All rights reserved.
 // Use of this source code is governed by a MIT-style
 // license that can be found in the LICENSE file.
 
+// +build sqlite
+
 package models
 
 import (
        _ "github.com/mattn/go-sqlite3"
 )
+
+func init() {
+       EnableSQLite3 = true
+}