using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace FinlyticEngine.Migrations { /// public partial class AddEvaluationOutcomeTrackingAndScanCycles : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "OutcomeReason", table: "engine_evaluation_snapshots", type: "integer", nullable: false, defaultValue: 0); migrationBuilder.AddColumn( name: "PassedSimulationVeto", table: "engine_evaluation_snapshots", type: "boolean", nullable: false, defaultValue: true); migrationBuilder.AddColumn( name: "ProposalId", table: "engine_evaluation_snapshots", type: "uuid", nullable: true); migrationBuilder.AddColumn( name: "ReliabilityBonus", table: "engine_evaluation_snapshots", type: "numeric(6,2)", nullable: false, defaultValue: 0m); migrationBuilder.AddColumn( name: "TriggerSource", table: "engine_evaluation_snapshots", type: "integer", nullable: false, defaultValue: 0); migrationBuilder.AddColumn( name: "TriggeredByUserId", table: "engine_evaluation_snapshots", type: "uuid", nullable: true); migrationBuilder.CreateTable( name: "engine_scan_cycles", columns: table => new { Id = table.Column(type: "uuid", nullable: false), CycleStartedAtUtc = table.Column(type: "timestamp with time zone", nullable: false), RequestedLimit = table.Column(type: "integer", nullable: false), RequestedMinScore = table.Column(type: "numeric(6,2)", nullable: true), CandidatesReturnedCount = table.Column(type: "integer", nullable: false), CandidateIsins = table.Column(type: "jsonb", nullable: false) }, constraints: table => { table.PrimaryKey("PK_engine_scan_cycles", x => x.Id); }); migrationBuilder.CreateIndex( name: "IX_engine_evaluation_snapshots_OutcomeReason_EvaluatedAtUtc", table: "engine_evaluation_snapshots", columns: new[] { "OutcomeReason", "EvaluatedAtUtc" }); migrationBuilder.CreateIndex( name: "IX_engine_evaluation_snapshots_TriggerSource_EvaluatedAtUtc", table: "engine_evaluation_snapshots", columns: new[] { "TriggerSource", "EvaluatedAtUtc" }); migrationBuilder.CreateIndex( name: "IX_engine_scan_cycles_CycleStartedAtUtc", table: "engine_scan_cycles", column: "CycleStartedAtUtc"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "engine_scan_cycles"); migrationBuilder.DropIndex( name: "IX_engine_evaluation_snapshots_OutcomeReason_EvaluatedAtUtc", table: "engine_evaluation_snapshots"); migrationBuilder.DropIndex( name: "IX_engine_evaluation_snapshots_TriggerSource_EvaluatedAtUtc", table: "engine_evaluation_snapshots"); migrationBuilder.DropColumn( name: "OutcomeReason", table: "engine_evaluation_snapshots"); migrationBuilder.DropColumn( name: "PassedSimulationVeto", table: "engine_evaluation_snapshots"); migrationBuilder.DropColumn( name: "ProposalId", table: "engine_evaluation_snapshots"); migrationBuilder.DropColumn( name: "ReliabilityBonus", table: "engine_evaluation_snapshots"); migrationBuilder.DropColumn( name: "TriggerSource", table: "engine_evaluation_snapshots"); migrationBuilder.DropColumn( name: "TriggeredByUserId", table: "engine_evaluation_snapshots"); } } }