small migration fix for MySql

This commit is contained in:
RaidMax 2019-02-22 19:35:03 -06:00
parent 4b1f44cc2a
commit de69bed792
3 changed files with 15 additions and 4 deletions

View File

@ -23,6 +23,8 @@ namespace SharedLibraryCore.Database.Models
public virtual EFClient Client { get; set; } public virtual EFClient Client { get; set; }
[Required] [Required]
[MinLength(3)] [MinLength(3)]
[StringLength(32)]
[MaxLength(32)]
public string Key { get; set; } public string Key { get; set; }
[Required] [Required]
public string Value { get; set; } public string Value { get; set; }

View File

@ -6,10 +6,18 @@ namespace SharedLibraryCore.Migrations
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.CreateIndex( if (migrationBuilder.ActiveProvider == "Pomelo.EntityFrameworkCore.MySql")
name: "IX_EFMeta_Key", {
table: "EFMeta", migrationBuilder.Sql("CREATE FULLTEXT INDEX IX_EFMeta_Key ON EFMeta ( `Key` );");
column: "Key"); }
else
{
migrationBuilder.CreateIndex(
name: "IX_EFMeta_Key",
table: "EFMeta",
column: "Key");
}
} }
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)

View File

@ -18,6 +18,7 @@
<Compile Remove="Migrations\20181126233300_AddEndpointToEFServer.cs" /> <Compile Remove="Migrations\20181126233300_AddEndpointToEFServer.cs" />
<Compile Remove="Migrations\20181127143920_AddEndpointToEFServerUpdateServerIdType.cs" /> <Compile Remove="Migrations\20181127143920_AddEndpointToEFServerUpdateServerIdType.cs" />
<Compile Remove="Migrations\20190222234606_AddIndexToEFMeta-KeyAndClientId.cs" /> <Compile Remove="Migrations\20190222234606_AddIndexToEFMeta-KeyAndClientId.cs" />
<Compile Remove="Migrations\20190223012312_SetMaxLengthForMetaKey.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>