using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations.AppDb
{
///
public partial class AddRewardConfigDropActivityToken : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
// ActivityToken_* → Reward_* 통합 (d3 M2). 기존 3개 컬럼 드랍.
migrationBuilder.DropColumn(name: "ActivityToken_CommentToken", table: "Config");
migrationBuilder.DropColumn(name: "ActivityToken_DailyTokenCap", table: "Config");
migrationBuilder.DropColumn(name: "ActivityToken_PostToken", table: "Config");
// Reward_* 신규 컬럼
migrationBuilder.AddColumn(name: "Reward_PostExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 작성 지급 경험치");
migrationBuilder.AddColumn(name: "Reward_PostPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 작성 지급 토큰");
migrationBuilder.AddColumn(name: "Reward_CommentExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 작성 지급 경험치");
migrationBuilder.AddColumn(name: "Reward_CommentPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 작성 지급 토큰");
migrationBuilder.AddColumn(name: "Reward_LikeGivenExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(누른 쪽) 지급 경험치");
migrationBuilder.AddColumn(name: "Reward_LikeReceivedPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(받은 쪽) 지급 토큰");
migrationBuilder.AddColumn(name: "Reward_MinPostLength", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "보상 지급 최소 게시글 길이 (0=제한 없음)");
migrationBuilder.AddColumn(name: "Reward_MinCommentLength", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "보상 지급 최소 댓글 길이 (0=제한 없음)");
migrationBuilder.AddColumn(name: "Reward_NewMemberHoldDays", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "신규 회원 보상 유예 기간(일, 0=유예 없음)");
migrationBuilder.AddColumn(name: "Reward_PostDailyCount", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 보상 일일 횟수 상한 (0=무제한)");
migrationBuilder.AddColumn(name: "Reward_PostDailyExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 보상 일일 경험치 상한 (0=무제한)");
migrationBuilder.AddColumn(name: "Reward_PostDailyPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 보상 일일 토큰 상한 (0=무제한)");
migrationBuilder.AddColumn(name: "Reward_CommentDailyCount", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 보상 일일 횟수 상한 (0=무제한)");
migrationBuilder.AddColumn(name: "Reward_CommentDailyExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 보상 일일 경험치 상한 (0=무제한)");
migrationBuilder.AddColumn(name: "Reward_CommentDailyPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 보상 일일 토큰 상한 (0=무제한)");
migrationBuilder.AddColumn(name: "Reward_LikeGivenDailyCount", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(누른 쪽) 보상 일일 횟수 상한 (0=무제한)");
migrationBuilder.AddColumn(name: "Reward_LikeGivenDailyExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(누른 쪽) 보상 일일 경험치 상한 (0=무제한)");
migrationBuilder.AddColumn(name: "Reward_LikeReceivedDailyCount", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(받은 쪽) 보상 일일 횟수 상한 (0=무제한)");
migrationBuilder.AddColumn(name: "Reward_LikeReceivedDailyPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(받은 쪽) 보상 일일 토큰 상한 (0=무제한)");
migrationBuilder.AddColumn(name: "Reward_ChatDailyCount", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "채팅 보상 일일 횟수 상한 (0=무제한)");
migrationBuilder.AddColumn(name: "Reward_ChatDailyExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "채팅 보상 일일 경험치 상한 (0=무제한)");
// 일일 보상 캡 원장 (복합 PK)
migrationBuilder.CreateTable(
name: "MemberDailyRewardCounter",
columns: table => new
{
MemberID = table.Column(type: "int", nullable: false, comment: "회원 ID"),
RewardDate = table.Column(type: "date", nullable: false, comment: "KST 기준 일자"),
ActionType = table.Column(type: "tinyint", nullable: false, comment: "액션 유형 (Post=1..PaperReward=8)"),
Count = table.Column(type: "int", nullable: false, comment: "오늘 지급 횟수"),
ExpTotal = table.Column(type: "int", nullable: false, comment: "오늘 지급 경험치 합계"),
PointTotal = table.Column(type: "int", nullable: false, comment: "오늘 지급 토큰 합계")
},
constraints: table =>
{
table.PrimaryKey("PK_MemberDailyRewardCounter", x => new { x.MemberID, x.RewardDate, x.ActionType });
table.ForeignKey(
name: "FK_MemberDailyRewardCounter_Member_MemberID",
column: x => x.MemberID,
principalTable: "Member",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
},
comment: "일일 보상 캡 원장 (d3 M2)");
migrationBuilder.CreateIndex(
name: "IX_MemberDailyRewardCounter_RewardDate",
table: "MemberDailyRewardCounter",
column: "RewardDate");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(name: "MemberDailyRewardCounter");
migrationBuilder.DropColumn(name: "Reward_PostExp", table: "Config");
migrationBuilder.DropColumn(name: "Reward_PostPoint", table: "Config");
migrationBuilder.DropColumn(name: "Reward_CommentExp", table: "Config");
migrationBuilder.DropColumn(name: "Reward_CommentPoint", table: "Config");
migrationBuilder.DropColumn(name: "Reward_LikeGivenExp", table: "Config");
migrationBuilder.DropColumn(name: "Reward_LikeReceivedPoint", table: "Config");
migrationBuilder.DropColumn(name: "Reward_MinPostLength", table: "Config");
migrationBuilder.DropColumn(name: "Reward_MinCommentLength", table: "Config");
migrationBuilder.DropColumn(name: "Reward_NewMemberHoldDays", table: "Config");
migrationBuilder.DropColumn(name: "Reward_PostDailyCount", table: "Config");
migrationBuilder.DropColumn(name: "Reward_PostDailyExp", table: "Config");
migrationBuilder.DropColumn(name: "Reward_PostDailyPoint", table: "Config");
migrationBuilder.DropColumn(name: "Reward_CommentDailyCount", table: "Config");
migrationBuilder.DropColumn(name: "Reward_CommentDailyExp", table: "Config");
migrationBuilder.DropColumn(name: "Reward_CommentDailyPoint", table: "Config");
migrationBuilder.DropColumn(name: "Reward_LikeGivenDailyCount", table: "Config");
migrationBuilder.DropColumn(name: "Reward_LikeGivenDailyExp", table: "Config");
migrationBuilder.DropColumn(name: "Reward_LikeReceivedDailyCount", table: "Config");
migrationBuilder.DropColumn(name: "Reward_LikeReceivedDailyPoint", table: "Config");
migrationBuilder.DropColumn(name: "Reward_ChatDailyCount", table: "Config");
migrationBuilder.DropColumn(name: "Reward_ChatDailyExp", table: "Config");
// 롤백: ActivityToken_* 복원
migrationBuilder.AddColumn(name: "ActivityToken_CommentToken", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 작성 지급 토큰");
migrationBuilder.AddColumn(name: "ActivityToken_DailyTokenCap", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "활동 토큰 일일 상한 (0=무제한)");
migrationBuilder.AddColumn(name: "ActivityToken_PostToken", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 작성 지급 토큰");
}
}
}