Phase 6: Tabellen-Namenskonvention (core_ / mod_<modul>_)

- Core-Tabellen mit core_-Praefix: core_accounts, core_positions, core_markets,
  core_trade_log. CoreDbContext.ToTable angepasst, Migration neu erzeugt + angewandt.
- Modul-Tabellen erhalten spaeter mod_copytrading_-Praefix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Richard
2026-07-05 13:37:52 +02:00
co-authored by Claude Opus 4.8
parent 97bff61fc5
commit ad9bb684d4
4 changed files with 31 additions and 31 deletions
@@ -21,7 +21,7 @@ namespace PolyTrader.Core.Persistence.Ef
{
b.Entity<AccountState>(e =>
{
e.ToTable("accounts");
e.ToTable("core_accounts");
e.HasKey(x => x.AccountId);
e.Property(x => x.AccountId).ValueGeneratedNever();
e.Ignore(x => x.OpenPositions); // Runtime-Only (In-Memory Hot-Path)
@@ -39,7 +39,7 @@ namespace PolyTrader.Core.Persistence.Ef
b.Entity<Position>(e =>
{
e.ToTable("positions");
e.ToTable("core_positions");
e.HasKey(x => new { x.AccountId, x.IsDemo, x.TokenId });
e.Property(x => x.TokenId).HasMaxLength(120);
e.Property(x => x.MarketSlug).HasMaxLength(300);
@@ -58,7 +58,7 @@ namespace PolyTrader.Core.Persistence.Ef
b.Entity<MarketData>(e =>
{
e.ToTable("markets");
e.ToTable("core_markets");
e.HasKey(x => x.Id);
e.Property(x => x.Id).HasMaxLength(120);
e.Property(x => x.ConditionId).HasMaxLength(120);
@@ -71,7 +71,7 @@ namespace PolyTrader.Core.Persistence.Ef
b.Entity<TradeRecord>(e =>
{
e.ToTable("trade_log");
e.ToTable("core_trade_log");
e.HasKey(x => x.Id);
e.Property(x => x.Id).HasMaxLength(64);
e.Property(x => x.ModuleName).HasMaxLength(64);
@@ -12,7 +12,7 @@ using PolyTrader.Core.Persistence.Ef;
namespace PolyTrader.Core.Persistence.Ef.Migrations
{
[DbContext(typeof(CoreDbContext))]
[Migration("20260705112545_InitialCore")]
[Migration("20260705113713_InitialCore")]
partial class InitialCore
{
/// <inheritdoc />
@@ -91,7 +91,7 @@ namespace PolyTrader.Core.Persistence.Ef.Migrations
b.HasKey("AccountId");
b.ToTable("accounts", (string)null);
b.ToTable("core_accounts", (string)null);
});
modelBuilder.Entity("PolyTraderSharp.Models.MarketData", b =>
@@ -142,7 +142,7 @@ namespace PolyTrader.Core.Persistence.Ef.Migrations
b.HasKey("Id");
b.ToTable("markets", (string)null);
b.ToTable("core_markets", (string)null);
});
modelBuilder.Entity("PolyTraderSharp.Models.Position", b =>
@@ -223,7 +223,7 @@ namespace PolyTrader.Core.Persistence.Ef.Migrations
b.HasKey("AccountId", "IsDemo", "TokenId");
b.ToTable("positions", (string)null);
b.ToTable("core_positions", (string)null);
});
modelBuilder.Entity("PolyTraderSharp.Models.TradeRecord", b =>
@@ -302,7 +302,7 @@ namespace PolyTrader.Core.Persistence.Ef.Migrations
b.HasIndex("ModuleName");
b.ToTable("trade_log", (string)null);
b.ToTable("core_trade_log", (string)null);
});
#pragma warning restore 612, 618
}
@@ -15,7 +15,7 @@ namespace PolyTrader.Core.Persistence.Ef.Migrations
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "accounts",
name: "core_accounts",
columns: table => new
{
AccountId = table.Column<int>(type: "int", nullable: false),
@@ -43,12 +43,12 @@ namespace PolyTrader.Core.Persistence.Ef.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_accounts", x => x.AccountId);
table.PrimaryKey("PK_core_accounts", x => x.AccountId);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "markets",
name: "core_markets",
columns: table => new
{
Id = table.Column<string>(type: "varchar(120)", maxLength: 120, nullable: false)
@@ -72,12 +72,12 @@ namespace PolyTrader.Core.Persistence.Ef.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_markets", x => x.Id);
table.PrimaryKey("PK_core_markets", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "positions",
name: "core_positions",
columns: table => new
{
AccountId = table.Column<int>(type: "int", nullable: false),
@@ -109,12 +109,12 @@ namespace PolyTrader.Core.Persistence.Ef.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_positions", x => new { x.AccountId, x.IsDemo, x.TokenId });
table.PrimaryKey("PK_core_positions", x => new { x.AccountId, x.IsDemo, x.TokenId });
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "trade_log",
name: "core_trade_log",
columns: table => new
{
Id = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false)
@@ -143,23 +143,23 @@ namespace PolyTrader.Core.Persistence.Ef.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_trade_log", x => x.Id);
table.PrimaryKey("PK_core_trade_log", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_trade_log_AccountId",
table: "trade_log",
name: "IX_core_trade_log_AccountId",
table: "core_trade_log",
column: "AccountId");
migrationBuilder.CreateIndex(
name: "IX_trade_log_ClosedAt",
table: "trade_log",
name: "IX_core_trade_log_ClosedAt",
table: "core_trade_log",
column: "ClosedAt");
migrationBuilder.CreateIndex(
name: "IX_trade_log_ModuleName",
table: "trade_log",
name: "IX_core_trade_log_ModuleName",
table: "core_trade_log",
column: "ModuleName");
}
@@ -167,16 +167,16 @@ namespace PolyTrader.Core.Persistence.Ef.Migrations
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "accounts");
name: "core_accounts");
migrationBuilder.DropTable(
name: "markets");
name: "core_markets");
migrationBuilder.DropTable(
name: "positions");
name: "core_positions");
migrationBuilder.DropTable(
name: "trade_log");
name: "core_trade_log");
}
}
}
@@ -88,7 +88,7 @@ namespace PolyTrader.Core.Persistence.Ef.Migrations
b.HasKey("AccountId");
b.ToTable("accounts", (string)null);
b.ToTable("core_accounts", (string)null);
});
modelBuilder.Entity("PolyTraderSharp.Models.MarketData", b =>
@@ -139,7 +139,7 @@ namespace PolyTrader.Core.Persistence.Ef.Migrations
b.HasKey("Id");
b.ToTable("markets", (string)null);
b.ToTable("core_markets", (string)null);
});
modelBuilder.Entity("PolyTraderSharp.Models.Position", b =>
@@ -220,7 +220,7 @@ namespace PolyTrader.Core.Persistence.Ef.Migrations
b.HasKey("AccountId", "IsDemo", "TokenId");
b.ToTable("positions", (string)null);
b.ToTable("core_positions", (string)null);
});
modelBuilder.Entity("PolyTraderSharp.Models.TradeRecord", b =>
@@ -299,7 +299,7 @@ namespace PolyTrader.Core.Persistence.Ef.Migrations
b.HasIndex("ModuleName");
b.ToTable("trade_log", (string)null);
b.ToTable("core_trade_log", (string)null);
});
#pragma warning restore 612, 618
}