Fix index drop order in AddTradeContextAndSubcategory migration to satisfy MySQL FK constraints

This commit is contained in:
Richard
2026-07-05 20:16:45 +02:00
parent d3fac35785
commit 689ba45533
@@ -1,4 +1,4 @@
using System;
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
@@ -12,10 +12,6 @@ namespace Predictalytics.Infrastructure.Migrations
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_TraderCategoryPerformances_TraderId_Category",
table: "TraderCategoryPerformances");
migrationBuilder.AddColumn<DateTime>(
name: "LastAnalyzedAt",
table: "Traders",
@@ -62,6 +58,10 @@ namespace Predictalytics.Infrastructure.Migrations
columns: new[] { "TraderId", "Category", "Subcategory" },
unique: true);
migrationBuilder.DropIndex(
name: "IX_TraderCategoryPerformances_TraderId_Category",
table: "TraderCategoryPerformances");
migrationBuilder.CreateIndex(
name: "IX_TradeContexts_TradeId",
table: "TradeContexts",
@@ -75,10 +75,6 @@ namespace Predictalytics.Infrastructure.Migrations
migrationBuilder.DropTable(
name: "TradeContexts");
migrationBuilder.DropIndex(
name: "IX_TraderCategoryPerformances_TraderId_Category_Subcategory",
table: "TraderCategoryPerformances");
migrationBuilder.DropColumn(
name: "LastAnalyzedAt",
table: "Traders");
@@ -92,6 +88,10 @@ namespace Predictalytics.Infrastructure.Migrations
table: "TraderCategoryPerformances",
columns: new[] { "TraderId", "Category" },
unique: true);
migrationBuilder.DropIndex(
name: "IX_TraderCategoryPerformances_TraderId_Category_Subcategory",
table: "TraderCategoryPerformances");
}
}
}