diff --git a/SharedLibraryCore/Database/Models/EFMeta.cs b/SharedLibraryCore/Database/Models/EFMeta.cs index ac2eb4c3..3525fb28 100644 --- a/SharedLibraryCore/Database/Models/EFMeta.cs +++ b/SharedLibraryCore/Database/Models/EFMeta.cs @@ -23,6 +23,8 @@ namespace SharedLibraryCore.Database.Models public virtual EFClient Client { get; set; } [Required] [MinLength(3)] + [StringLength(32)] + [MaxLength(32)] public string Key { get; set; } [Required] public string Value { get; set; } diff --git a/SharedLibraryCore/Migrations/20190222234742_AddIndexToEFMeta-KeyAndClientId.cs b/SharedLibraryCore/Migrations/20190222234742_AddIndexToEFMeta-KeyAndClientId.cs index 2b726c9e..b90b489b 100644 --- a/SharedLibraryCore/Migrations/20190222234742_AddIndexToEFMeta-KeyAndClientId.cs +++ b/SharedLibraryCore/Migrations/20190222234742_AddIndexToEFMeta-KeyAndClientId.cs @@ -6,10 +6,18 @@ namespace SharedLibraryCore.Migrations { protected override void Up(MigrationBuilder migrationBuilder) { - migrationBuilder.CreateIndex( - name: "IX_EFMeta_Key", - table: "EFMeta", - column: "Key"); + if (migrationBuilder.ActiveProvider == "Pomelo.EntityFrameworkCore.MySql") + { + migrationBuilder.Sql("CREATE FULLTEXT INDEX IX_EFMeta_Key ON EFMeta ( `Key` );"); + } + + else + { + migrationBuilder.CreateIndex( + name: "IX_EFMeta_Key", + table: "EFMeta", + column: "Key"); + } } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/SharedLibraryCore/SharedLibraryCore.csproj b/SharedLibraryCore/SharedLibraryCore.csproj index c4ca779a..ad3c9afe 100644 --- a/SharedLibraryCore/SharedLibraryCore.csproj +++ b/SharedLibraryCore/SharedLibraryCore.csproj @@ -18,6 +18,7 @@ +