From de69bed79213f1229bd0f1a1b8a6339ba8118f37 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Fri, 22 Feb 2019 19:35:03 -0600 Subject: [PATCH] small migration fix for MySql --- SharedLibraryCore/Database/Models/EFMeta.cs | 2 ++ ...0222234742_AddIndexToEFMeta-KeyAndClientId.cs | 16 ++++++++++++---- SharedLibraryCore/SharedLibraryCore.csproj | 1 + 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/SharedLibraryCore/Database/Models/EFMeta.cs b/SharedLibraryCore/Database/Models/EFMeta.cs index ac2eb4c30..3525fb286 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 2b726c9e0..b90b489be 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 c4ca779ad..ad3c9afe6 100644 --- a/SharedLibraryCore/SharedLibraryCore.csproj +++ b/SharedLibraryCore/SharedLibraryCore.csproj @@ -18,6 +18,7 @@ +