diff --git a/Src/Asp.NetCore2/SqlSugar/Entities/ConnMoreSettings.cs b/Src/Asp.NetCore2/SqlSugar/Entities/ConnMoreSettings.cs index dab870dd3..46f27a6bd 100644 --- a/Src/Asp.NetCore2/SqlSugar/Entities/ConnMoreSettings.cs +++ b/Src/Asp.NetCore2/SqlSugar/Entities/ConnMoreSettings.cs @@ -28,6 +28,7 @@ namespace SqlSugar public bool EnableModelFuncMappingColumn { get; set; } public bool EnableOracleIdentity { get; set; } public bool EnableCodeFirstUpdatePrecision { get; set; } + public bool SqliteCodeFirstEnableDropColumn { get; set; } public bool IsCorrectErrorSqlParameterName { get; set; } } } diff --git a/Src/Asp.NetCore2/SqlSugar/Realization/Sqlite/CodeFirst/SqliteCodeFirst.cs b/Src/Asp.NetCore2/SqlSugar/Realization/Sqlite/CodeFirst/SqliteCodeFirst.cs index cdb044bdf..8d5cfc7b7 100644 --- a/Src/Asp.NetCore2/SqlSugar/Realization/Sqlite/CodeFirst/SqliteCodeFirst.cs +++ b/Src/Asp.NetCore2/SqlSugar/Realization/Sqlite/CodeFirst/SqliteCodeFirst.cs @@ -49,8 +49,12 @@ namespace SqlSugar } foreach (var item in dropColumns) { - //this.Context.DbMaintenance.DropColumn(tableName, item.DbColumnName); - //isChange = true; + //only support .net core + if (this.Context.CurrentConnectionConfig?.MoreSettings?.SqliteCodeFirstEnableDropColumn == true) + { + this.Context.DbMaintenance.DropColumn(tableName, item.DbColumnName); + isChange = true; + } } //foreach (var item in alterColumns) //{ diff --git a/Src/Asp.NetCore2/SqlSugar/Utilities/UtilMethods.cs b/Src/Asp.NetCore2/SqlSugar/Utilities/UtilMethods.cs index 2f684116b..6ef2416b6 100644 --- a/Src/Asp.NetCore2/SqlSugar/Utilities/UtilMethods.cs +++ b/Src/Asp.NetCore2/SqlSugar/Utilities/UtilMethods.cs @@ -525,7 +525,8 @@ namespace SqlSugar EnableCodeFirstUpdatePrecision=it.MoreSettings.EnableCodeFirstUpdatePrecision, SqliteCodeFirstEnableDefaultValue=it.MoreSettings.SqliteCodeFirstEnableDefaultValue, SqliteCodeFirstEnableDescription=it.MoreSettings.SqliteCodeFirstEnableDescription, - IsCorrectErrorSqlParameterName = it.MoreSettings.IsCorrectErrorSqlParameterName + IsCorrectErrorSqlParameterName = it.MoreSettings.IsCorrectErrorSqlParameterName, + SqliteCodeFirstEnableDropColumn=it.MoreSettings.SqliteCodeFirstEnableDropColumn }, SqlMiddle = it.SqlMiddle == null ? null : new SqlMiddle