using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Infrastructure.Migrations.AppDb { /// public partial class AddStatusItems : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterTable( name: "MemberItem", comment: "계정 귀속 아이템 (지위 아이템 장착형 + 소모품)", oldComment: "계정 귀속 소모품 아이템"); migrationBuilder.AlterColumn( name: "ItemKind", table: "Product", type: "tinyint", nullable: true, comment: "아이템 종류 (null=일반상품, 2~4=지위, 5~11=소모품)", oldClrType: typeof(byte), oldType: "tinyint", oldNullable: true, oldComment: "소모품 종류 (null=일반상품, 5~11=소모품)"); migrationBuilder.AlterColumn( name: "DurationDays", table: "Product", type: "int", nullable: false, defaultValue: 0, comment: "아이템 효과 지속일 (0=즉시소모/영구)", oldClrType: typeof(int), oldType: "int", oldDefaultValue: 0, oldComment: "소모품 효과 지속일 (0=즉시소모)"); migrationBuilder.AddColumn( name: "EffectPayload", table: "Product", type: "nvarchar(max)", nullable: true, comment: "지위 아이템 효과 페이로드 JSON (색상·아이콘·애니메이션)"); migrationBuilder.AddColumn( name: "IsGiftable", table: "Product", type: "bit", nullable: false, defaultValue: false, comment: "선물하기 가능 여부"); migrationBuilder.AddColumn( name: "GiftMessage", table: "Order", type: "nvarchar(200)", maxLength: 200, nullable: true, comment: "선물 메시지"); migrationBuilder.AddColumn( name: "GiftToMemberID", table: "Order", type: "int", nullable: true, comment: "선물 수신자 회원 ID (null=본인구매)"); migrationBuilder.AlterColumn( name: "MemberID", table: "MemberItem", type: "int", nullable: false, comment: "회원 ID (지급 대상)", oldClrType: typeof(int), oldType: "int", oldComment: "회원 ID"); migrationBuilder.AlterColumn( name: "Kind", table: "MemberItem", type: "tinyint", nullable: false, comment: "아이템 종류 (2~4=지위, 5~11=소모품)", oldClrType: typeof(byte), oldType: "tinyint", oldComment: "아이템 종류 (5~11)"); migrationBuilder.AlterColumn( name: "DurationDays", table: "MemberItem", type: "int", nullable: false, defaultValue: 0, comment: "효과 지속일 (0=즉시소모/영구)", oldClrType: typeof(int), oldType: "int", oldDefaultValue: 0, oldComment: "효과 지속일 (0=즉시소모)"); migrationBuilder.AddColumn( name: "EquipSlot", table: "MemberItem", type: "tinyint", nullable: true, comment: "장착 슬롯 (1=Badge, 2=NicknameEffect, 3=CommentEffect, null=소모품)"); migrationBuilder.AddColumn( name: "ExpiresAt", table: "MemberItem", type: "datetime2", nullable: true, comment: "만료 일시 (null=영구)"); migrationBuilder.AddColumn( name: "GiftFromMemberID", table: "MemberItem", type: "int", nullable: true, comment: "선물 발신자 회원 ID (null=본인구매)"); migrationBuilder.AddColumn( name: "IsEquipped", table: "MemberItem", type: "bit", nullable: false, defaultValue: false, comment: "장착 여부 (지위 아이템)"); migrationBuilder.CreateIndex( name: "IX_MemberItem_MemberID_EquipSlot", table: "MemberItem", columns: new[] { "MemberID", "EquipSlot" }, unique: true, filter: "[IsEquipped] = 1"); migrationBuilder.CreateIndex( name: "IX_MemberItem_MemberID_ExpiresAt", table: "MemberItem", columns: new[] { "MemberID", "ExpiresAt" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropIndex( name: "IX_MemberItem_MemberID_EquipSlot", table: "MemberItem"); migrationBuilder.DropIndex( name: "IX_MemberItem_MemberID_ExpiresAt", table: "MemberItem"); migrationBuilder.DropColumn( name: "EffectPayload", table: "Product"); migrationBuilder.DropColumn( name: "IsGiftable", table: "Product"); migrationBuilder.DropColumn( name: "GiftMessage", table: "Order"); migrationBuilder.DropColumn( name: "GiftToMemberID", table: "Order"); migrationBuilder.DropColumn( name: "EquipSlot", table: "MemberItem"); migrationBuilder.DropColumn( name: "ExpiresAt", table: "MemberItem"); migrationBuilder.DropColumn( name: "GiftFromMemberID", table: "MemberItem"); migrationBuilder.DropColumn( name: "IsEquipped", table: "MemberItem"); migrationBuilder.AlterTable( name: "MemberItem", comment: "계정 귀속 소모품 아이템", oldComment: "계정 귀속 아이템 (지위 아이템 장착형 + 소모품)"); migrationBuilder.AlterColumn( name: "ItemKind", table: "Product", type: "tinyint", nullable: true, comment: "소모품 종류 (null=일반상품, 5~11=소모품)", oldClrType: typeof(byte), oldType: "tinyint", oldNullable: true, oldComment: "아이템 종류 (null=일반상품, 2~4=지위, 5~11=소모품)"); migrationBuilder.AlterColumn( name: "DurationDays", table: "Product", type: "int", nullable: false, defaultValue: 0, comment: "소모품 효과 지속일 (0=즉시소모)", oldClrType: typeof(int), oldType: "int", oldDefaultValue: 0, oldComment: "아이템 효과 지속일 (0=즉시소모/영구)"); migrationBuilder.AlterColumn( name: "MemberID", table: "MemberItem", type: "int", nullable: false, comment: "회원 ID", oldClrType: typeof(int), oldType: "int", oldComment: "회원 ID (지급 대상)"); migrationBuilder.AlterColumn( name: "Kind", table: "MemberItem", type: "tinyint", nullable: false, comment: "아이템 종류 (5~11)", oldClrType: typeof(byte), oldType: "tinyint", oldComment: "아이템 종류 (2~4=지위, 5~11=소모품)"); migrationBuilder.AlterColumn( name: "DurationDays", table: "MemberItem", type: "int", nullable: false, defaultValue: 0, comment: "효과 지속일 (0=즉시소모)", oldClrType: typeof(int), oldType: "int", oldDefaultValue: 0, oldComment: "효과 지속일 (0=즉시소모/영구)"); } } }