2019-12-04 00:49:28 -05:00
|
|
|
package model
|
|
|
|
|
|
|
|
import (
|
2019-12-07 02:05:48 -05:00
|
|
|
"github.com/HFO4/cloudreve/pkg/conf"
|
2019-12-05 04:01:14 -05:00
|
|
|
"github.com/jinzhu/gorm"
|
2019-12-04 00:49:28 -05:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestMigration(t *testing.T) {
|
|
|
|
asserts := assert.New(t)
|
2019-12-07 02:05:48 -05:00
|
|
|
conf.DatabaseConfig.Type = "sqlite3"
|
2019-12-05 04:01:14 -05:00
|
|
|
DB, _ = gorm.Open("sqlite3", ":memory:")
|
2019-12-04 00:49:28 -05:00
|
|
|
|
|
|
|
asserts.NotPanics(func() {
|
|
|
|
migration()
|
|
|
|
})
|
2019-12-07 02:05:48 -05:00
|
|
|
conf.DatabaseConfig.Type = "mysql"
|
2019-12-05 04:01:14 -05:00
|
|
|
DB = mockDB
|
2019-12-04 00:49:28 -05:00
|
|
|
}
|