using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IBKRTrader.Modules.Supervisor.Migrations
{
///
public partial class InitialSupervisor : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "sup_counterfactuals",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
DecisionId = table.Column(type: "bigint", nullable: false),
CheckedAt = table.Column(type: "datetime(6)", nullable: false),
SignalId = table.Column(type: "varchar(64)", maxLength: 64, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Module = table.Column(type: "varchar(50)", maxLength: 50, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Symbol = table.Column(type: "varchar(20)", maxLength: 20, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Reason = table.Column(type: "varchar(40)", maxLength: 40, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Side = table.Column(type: "varchar(10)", maxLength: 10, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
SignalPrice = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false),
LaterPrice = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false),
HypotheticalPnlPerShare = table.Column(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_sup_counterfactuals", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "sup_reports",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CreatedAt = table.Column(type: "datetime(6)", nullable: false),
Profile = table.Column(type: "varchar(50)", maxLength: 50, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Model = table.Column(type: "varchar(120)", maxLength: 120, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Question = table.Column(type: "varchar(4000)", maxLength: 4000, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Answer = table.Column(type: "text", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ToolCallsJson = table.Column(type: "text", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ToolCallCount = table.Column(type: "int", nullable: false),
PromptTokens = table.Column(type: "int", nullable: false),
CompletionTokens = table.Column(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_sup_reports", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_sup_counterfactuals_CheckedAt",
table: "sup_counterfactuals",
column: "CheckedAt");
migrationBuilder.CreateIndex(
name: "IX_sup_counterfactuals_DecisionId",
table: "sup_counterfactuals",
column: "DecisionId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_sup_counterfactuals_Reason",
table: "sup_counterfactuals",
column: "Reason");
migrationBuilder.CreateIndex(
name: "IX_sup_reports_CreatedAt",
table: "sup_reports",
column: "CreatedAt");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "sup_counterfactuals");
migrationBuilder.DropTable(
name: "sup_reports");
}
}
}