9c58278e08
* sqlite 驱动从 github.com/jinzhu/gorm/dialects/sqlite 改为 github.com/glebarez/go-sqlite,以移除对 cgo 的依赖 * // 兼容已有配置中的 "sqlite3" 配置项 * Update models/init.go: 修改变量名
21 lines
386 B
Go
21 lines
386 B
Go
package model
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/cloudreve/Cloudreve/v3/pkg/conf"
|
|
"github.com/jinzhu/gorm"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestMigration(t *testing.T) {
|
|
asserts := assert.New(t)
|
|
conf.DatabaseConfig.Type = "sqlite"
|
|
DB, _ = gorm.Open("sqlite", ":memory:")
|
|
|
|
asserts.NotPanics(func() {
|
|
migration()
|
|
})
|
|
conf.DatabaseConfig.Type = "mysql"
|
|
DB = mockDB
|
|
}
|