| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- namespace Infrastructure.Migrations.AppDb
- {
- /// <inheritdoc />
- public partial class AddMemberTrackRecord : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "MemberTrackRecord",
- columns: table => new
- {
- MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID (PK)"),
- Predictions = table.Column<int>(type: "int", nullable: false, comment: "채점 완료 예측 총계 (Hits+Misses+Voids)"),
- Hits = table.Column<int>(type: "int", nullable: false, comment: "적중 수"),
- Misses = table.Column<int>(type: "int", nullable: false, comment: "실패 수"),
- Voids = table.Column<int>(type: "int", nullable: false, comment: "무효 수 (표본 제외)"),
- HitRate = table.Column<decimal>(type: "decimal(5,2)", precision: 5, scale: 2, nullable: false, comment: "적중률 % (Hits/(Hits+Misses)*100)"),
- CurrentStreak = table.Column<int>(type: "int", nullable: false, comment: "현재 연속 적중"),
- BestStreak = table.Column<int>(type: "int", nullable: false, comment: "역대 최고 연속 적중"),
- Tier = table.Column<byte>(type: "tinyint", nullable: false, comment: "배지 등급 (0=None/1=Bronze/2=Silver/3=Gold/4=GoldAnt)"),
- UpdatedAt = table.Column<DateTime>(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");
- }
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "MemberTrackRecord");
- }
- }
- }
|