package models import ( "car-service/extend/util" "github.com/astaxie/beego" "github.com/astaxie/beego/orm" _ "github.com/mattn/go-sqlite3" ) func InitDb() { dbUrl := beego.AppConfig.String("dbUrl") rootPath := util.GetAppRootPath() dbPath := rootPath +"/"+ dbUrl orm.RegisterDriver("sqlite", orm.DRSqlite) _ = orm.RegisterDataBase("default", "sqlite3", dbPath) orm.RegisterModel(new(User), new(UserCar), new(SysUpgrade), new(UserClient), new(Restriction), new(Log)) _ = orm.RunSyncdb("default", false, true) }