From 33e03bb2cf250e93f09e1a0a6a42dad620d2e565 Mon Sep 17 00:00:00 2001 From: Sysaa <13461380@qq.com> Date: Thu, 30 Jun 2022 11:25:16 +0800 Subject: [PATCH] Update mysql createindex bug (cherry picked from commit a7a73fd94b0a3514d34fe131ae266ec5234295f7) # Conflicts: # Src/Asp.Net/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs --- .../SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs | 3 ++- .../Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs index 12bf743fa..8d2a8ab80 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs @@ -333,7 +333,8 @@ namespace SqlSugar } public virtual bool IsAnyIndex(string indexName) { - string sql = string.Format(this.IsAnyIndexSql, indexName); + //string sql = string.Format(this.IsAnyIndexSql, indexName); + string sql = string.Format(this.IsAnyIndexSql, indexName, this.Context.Ado.Connection.Database); return this.Context.Ado.GetInt(sql)>0; } public virtual bool AddRemark(EntityInfo entity) diff --git a/Src/Asp.NetCore2/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs b/Src/Asp.NetCore2/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs index c6150749c..261bac155 100644 --- a/Src/Asp.NetCore2/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs +++ b/Src/Asp.NetCore2/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs @@ -268,7 +268,7 @@ namespace SqlSugar { get { - return "SELECT count(*) FROM information_schema.statistics WHERE index_name = '{0}'"; + return "SELECT count(*) FROM information_schema.statistics WHERE index_name = '{0}' and index_schema = '{1}'"; } } #endregion