diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs index 9909ed44c..3264c2d05 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs @@ -174,6 +174,12 @@ namespace SqlSugar #endregion #region DDL + public virtual bool DropIndex(string indexName) + { + indexName = this.SqlBuilder.GetNoTranslationColumnName(indexName); + this.Context.Ado.ExecuteCommand($" DROP INDEX {indexName} "); + return true; + } public virtual bool DropView(string viewName) { viewName = this.SqlBuilder.GetNoTranslationColumnName(viewName); diff --git a/Src/Asp.NetCore2/SqlSugar/Interface/IDbMaintenance.cs b/Src/Asp.NetCore2/SqlSugar/Interface/IDbMaintenance.cs index d206c0200..594c31c39 100644 --- a/Src/Asp.NetCore2/SqlSugar/Interface/IDbMaintenance.cs +++ b/Src/Asp.NetCore2/SqlSugar/Interface/IDbMaintenance.cs @@ -40,6 +40,7 @@ namespace SqlSugar bool CreateIndex(string tableName, string[] columnNames, string IndexName, bool isUnique = false); bool DropTable(string tableName); bool DropView(string viewName); + bool DropIndex(string indexName); bool DropFunction(string funcName); bool DropProc(string procName); bool DropTable(params string[] tableName);