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.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
@@ -12,10 +12,6 @@ namespace Predictalytics.Infrastructure.Migrations
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropIndex(
name: "IX_TraderCategoryPerformances_TraderId_Category",
table: "TraderCategoryPerformances");
migrationBuilder.AddColumn<DateTime>( migrationBuilder.AddColumn<DateTime>(
name: "LastAnalyzedAt", name: "LastAnalyzedAt",
table: "Traders", table: "Traders",
@@ -62,6 +58,10 @@ namespace Predictalytics.Infrastructure.Migrations
columns: new[] { "TraderId", "Category", "Subcategory" }, columns: new[] { "TraderId", "Category", "Subcategory" },
unique: true); unique: true);
migrationBuilder.DropIndex(
name: "IX_TraderCategoryPerformances_TraderId_Category",
table: "TraderCategoryPerformances");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_TradeContexts_TradeId", name: "IX_TradeContexts_TradeId",
table: "TradeContexts", table: "TradeContexts",
@@ -75,10 +75,6 @@ namespace Predictalytics.Infrastructure.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "TradeContexts"); name: "TradeContexts");
migrationBuilder.DropIndex(
name: "IX_TraderCategoryPerformances_TraderId_Category_Subcategory",
table: "TraderCategoryPerformances");
migrationBuilder.DropColumn( migrationBuilder.DropColumn(
name: "LastAnalyzedAt", name: "LastAnalyzedAt",
table: "Traders"); table: "Traders");
@@ -92,6 +88,10 @@ namespace Predictalytics.Infrastructure.Migrations
table: "TraderCategoryPerformances", table: "TraderCategoryPerformances",
columns: new[] { "TraderId", "Category" }, columns: new[] { "TraderId", "Category" },
unique: true); unique: true);
migrationBuilder.DropIndex(
name: "IX_TraderCategoryPerformances_TraderId_Category_Subcategory",
table: "TraderCategoryPerformances");
} }
} }
} }