MySql codefirst collate

This commit is contained in:
sunkaixuan 2023-12-07 04:07:18 +08:00
parent 2a0e91d4ec
commit 50f5cfa166
2 changed files with 9 additions and 3 deletions

View File

@ -9,11 +9,13 @@ namespace SqlSugar
public class StaticConfig
{
public static bool EnableAot { get; set; }
public static Func<string,string> Encode { get; set; }
public static Func<string,string> Decode{ get; set; }
public static bool AppContext_ConvertInfinityDateTime { get; set; }
public static Func<string, string> Encode { get; set; }
public static Func<string, string> Decode { get; set; }
public static bool AppContext_ConvertInfinityDateTime { get; set; }
public const string CodeFirst_BigString = "varcharmax,longtext,text,clob";
public static string CodeFirst_MySqlCollate{get;set;}
public static Func<long> CustomSnowFlakeFunc;
public static Func<long> CustomSnowFlakeTimeErrorFunc;
public static Func<Guid> CustomGuidFunc;

View File

@ -415,6 +415,10 @@ WHERE EVENT_OBJECT_TABLE = '" + tableName + "'");
{
createSql = createSql.Replace("utf8 COLLATE utf8_general_ci", "utf8mb4");
}
if (!string.IsNullOrEmpty(StaticConfig.CodeFirst_MySqlCollate))
{
createSql += $" COLLATE {StaticConfig.CodeFirst_MySqlCollate} ";
}
newDb.Ado.ExecuteCommand(string.Format(createSql, databaseName, databaseDirectory));
}
return true;