using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Infrastructure.Migrations.AppDb { /// public partial class AddMemberTrackRecord : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "MemberTrackRecord", columns: table => new { MemberID = table.Column(type: "int", nullable: false, comment: "회원 ID (PK)"), Predictions = table.Column(type: "int", nullable: false, comment: "채점 완료 예측 총계 (Hits+Misses+Voids)"), Hits = table.Column(type: "int", nullable: false, comment: "적중 수"), Misses = table.Column(type: "int", nullable: false, comment: "실패 수"), Voids = table.Column(type: "int", nullable: false, comment: "무효 수 (표본 제외)"), HitRate = table.Column(type: "decimal(5,2)", precision: 5, scale: 2, nullable: false, comment: "적중률 % (Hits/(Hits+Misses)*100)"), CurrentStreak = table.Column(type: "int", nullable: false, comment: "현재 연속 적중"), BestStreak = table.Column(type: "int", nullable: false, comment: "역대 최고 연속 적중"), Tier = table.Column(type: "tinyint", nullable: false, comment: "배지 등급 (0=None/1=Bronze/2=Silver/3=Gold/4=GoldAnt)"), UpdatedAt = table.Column(type: "datetime2", nullable: false, comment: "갱신 일시") }, constraints: table => { table.PrimaryKey("PK_MemberTrackRecord", x => x.MemberID); table.ForeignKey( name: "FK_MemberTrackRecord_Member_MemberID", column: x => x.MemberID, principalTable: "Member", principalColumn: "ID", onDelete: ReferentialAction.Cascade); }, comment: "회원 예측 트랙레코드 집계 (적중률 배지·리더보드)"); migrationBuilder.CreateIndex( name: "IX_MemberTrackRecord_HitRate", table: "MemberTrackRecord", column: "HitRate", descending: new bool[0], filter: "[Predictions] >= 10"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "MemberTrackRecord"); } } }