Add: drop view , drop function, drop proc

This commit is contained in:
sunkaixuan 2023-09-17 12:58:25 +08:00
parent 03209b088c
commit f1e3bda568
2 changed files with 22 additions and 1 deletions

View File

@ -166,6 +166,24 @@ namespace SqlSugar
#endregion
#region DDL
public virtual bool DropView(string viewName)
{
viewName = this.SqlBuilder.GetNoTranslationColumnName(viewName);
this.Context.Ado.ExecuteCommand($" DROP VIEW {viewName} ");
return true;
}
public virtual bool DropFunction(string funcName)
{
funcName = this.SqlBuilder.GetNoTranslationColumnName(funcName);
this.Context.Ado.ExecuteCommand($" DROP FUNCTION {funcName} ");
return true;
}
public virtual bool DropProc(string procName)
{
procName = this.SqlBuilder.GetNoTranslationColumnName(procName);
this.Context.Ado.ExecuteCommand($" DROP PROCEDURE {procName} ");
return true;
}
/// <summary>
///by current connection string
/// </summary>

View File

@ -37,7 +37,10 @@ namespace SqlSugar
bool CreateIndex(string tableName, string [] columnNames, bool isUnique=false);
bool CreateIndex(string tableName, string[] columnNames, string IndexName, bool isUnique = false);
bool DropTable(string tableName);
bool DropTable(params string[] tableName);
bool DropView(string viewName);
bool DropFunction(string funcName);
bool DropProc(string procName);
; bool DropTable(params string[] tableName);
bool DropTable(params Type[] tableEntityTypes);
bool DropTable<T>();
bool DropTable<T,T2>();