UPDATE DbMaintenance

This commit is contained in:
sunkaixuan
2017-06-07 13:33:24 +08:00
parent 94264b3b81
commit ed5d947d7f
4 changed files with 48 additions and 3 deletions

View File

@@ -50,6 +50,25 @@ namespace SqlSugar
} }
#endregion #endregion
#region Check
public bool IsAnyTable(string tableName)
{
return true;
}
public bool IsAnyColumn(string tableName,string column)
{
return true;
}
public bool IsPrimaryKey(string tableName, string column)
{
return true;
}
public bool IsIdentity(string tableName, string column)
{
return true;
}
#endregion
#region DDL #region DDL
public bool AddColumnToTable(string tableName, DbColumnInfo column) public bool AddColumnToTable(string tableName, DbColumnInfo column)
{ {
@@ -71,7 +90,7 @@ namespace SqlSugar
public bool BackupDataBase() public bool BackupDataBase()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
#endregion #endregion
#region Private #region Private

View File

@@ -19,8 +19,10 @@ namespace SqlSugar
#region DDL #region DDL
protected abstract string AddColumnToTableSql { get; } protected abstract string AddColumnToTableSql { get; }
protected abstract string AlterColumnToTableSql { get; }
protected abstract string BackupDataBaseSql { get; } protected abstract string BackupDataBaseSql { get; }
protected abstract string CreateTableSql { get; } protected abstract string CreateTableSql { get; }
protected abstract string CreateTableColumn { get; }
protected abstract string BackupTableSql { get; } protected abstract string BackupTableSql { get; }
protected abstract string TruncateTableSql { get; } protected abstract string TruncateTableSql { get; }
#endregion #endregion

View File

@@ -8,6 +8,7 @@ namespace SqlSugar
{ {
SqlSugarClient Context { get; set; } SqlSugarClient Context { get; set; }
#region DML
List<DbTableInfo> GetViewInfoList(); List<DbTableInfo> GetViewInfoList();
List<DbTableInfo> GetTableInfoList(); List<DbTableInfo> GetTableInfoList();
@@ -17,7 +18,16 @@ namespace SqlSugar
List<string> GetIsIdentities(string tableName); List<string> GetIsIdentities(string tableName);
List<string> GetPrimaries(string tableName); List<string> GetPrimaries(string tableName);
#endregion
#region Check
bool IsAnyTable(string tableName);
bool IsAnyColumn(string tableName, string column);
bool IsPrimaryKey(string tableName, string column);
bool IsIdentity(string tableName, string column);
#endregion
#region DDL
bool TruncateTable(string tableName); bool TruncateTable(string tableName);
bool CreateTable(string tableName, List<DbColumnInfo> columns); bool CreateTable(string tableName, List<DbColumnInfo> columns);
@@ -25,5 +35,6 @@ namespace SqlSugar
bool AddColumnToTable(string tableName, DbColumnInfo column); bool AddColumnToTable(string tableName, DbColumnInfo column);
bool BackupDataBase(); bool BackupDataBase();
#endregion
} }
} }

View File

@@ -82,6 +82,13 @@ namespace SqlSugar
return "ALERT TABLE {0} ADD {1} {2} {3}"; return "ALERT TABLE {0} ADD {1} {2} {3}";
} }
} }
protected override string AlterColumnToTableSql {
get
{
return "ALERT TABLE {0} ALTER COLUMN {1}{2} {3} ";
}
}
protected override string BackupDataBaseSql protected override string BackupDataBaseSql
{ {
get get
@@ -93,8 +100,14 @@ namespace SqlSugar
{ {
get get
{ {
return @"CREATE TABLE {0} return "CREATE TABLE {0}(\r\n{1})";
{1}"; }
}
protected override string CreateTableColumn
{
get
{
return @"{0} {1}{2} {3}{4}\r\n";
} }
} }
protected override string TruncateTableSql protected override string TruncateTableSql