namespace IStation.DAL
|
{
|
public class DbInitial
|
{
|
|
/// <summary>
|
/// 初始数据库
|
/// </summary>
|
/// <param name="backup"></param>
|
/// <param name="stringDefaultLength"></param>
|
/// <returns></returns>
|
public static bool InitTables(bool backup = false, int stringDefaultLength = 250)
|
{
|
var db = ConfigHelper.GetSqlSugarClient();
|
if (db == null)
|
return false;
|
|
Type[] types = new Type[] {
|
// typeof(Entity.ScheduleCombine),
|
// typeof(Entity.ScheduleCombineLog),
|
typeof(Entity.ScheduleAnaLog),
|
|
};
|
db.DbMaintenance.CreateDatabase();
|
if (backup)
|
{
|
db.CodeFirst.BackupTable().InitTables(types);
|
}
|
else
|
{
|
db.CodeFirst.InitTables(types);
|
}
|
return true;
|
}
|
|
|
|
}
|
|
}
|