using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations.AppDb
{
///
public partial class AddRewardEngineAndAttendance : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "Attendance_BaseExp",
table: "Config",
type: "int",
nullable: false,
defaultValue: 0,
comment: "기본 경험치");
migrationBuilder.AddColumn(
name: "Attendance_BasePoint",
table: "Config",
type: "int",
nullable: false,
defaultValue: 0,
comment: "기본 포인트");
migrationBuilder.AddColumn(
name: "Attendance_IsEnabled",
table: "Config",
type: "bit",
nullable: false,
defaultValue: false,
comment: "출석 기능 활성화");
migrationBuilder.AddColumn(
name: "Attendance_RankBonusConfig",
table: "Config",
type: "nvarchar(2000)",
maxLength: 2000,
nullable: true,
comment: "순위별 보상 설정 (JSON)");
migrationBuilder.AddColumn(
name: "Attendance_StreakBonusMaxDays",
table: "Config",
type: "int",
nullable: false,
defaultValue: 0,
comment: "가중치 최대 적용 일수");
migrationBuilder.AddColumn(
name: "Attendance_StreakBonusPerDay",
table: "Config",
type: "int",
nullable: false,
defaultValue: 0,
comment: "1일당 추가 경험치");
migrationBuilder.AddColumn(
name: "Attendance_StreakBonusPointPerDay",
table: "Config",
type: "int",
nullable: false,
defaultValue: 0,
comment: "1일당 추가 포인트");
migrationBuilder.AddColumn(
name: "Attendance_UseRankBonus",
table: "Config",
type: "bit",
nullable: false,
defaultValue: false,
comment: "순위 보상 사용");
migrationBuilder.AddColumn(
name: "Attendance_UseStreakBonus",
table: "Config",
type: "bit",
nullable: false,
defaultValue: false,
comment: "연속 출석 가중치 사용");
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_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_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_LikeGivenExp",
table: "Config",
type: "int",
nullable: false,
defaultValue: 0,
comment: "추천(누른 쪽) 지급 경험치");
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_LikeReceivedPoint",
table: "Config",
type: "int",
nullable: false,
defaultValue: 0,
comment: "추천(받은 쪽) 지급 토큰");
migrationBuilder.AddColumn(
name: "Reward_MinCommentLength",
table: "Config",
type: "int",
nullable: false,
defaultValue: 0,
comment: "보상 지급 최소 댓글 길이 (0=제한 없음)");
migrationBuilder.AddColumn(
name: "Reward_MinPostLength",
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_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: "SignupReward_CashAmount",
table: "Config",
type: "int",
nullable: false,
defaultValue: 0,
comment: "지급 캐시 (Adjusted)");
migrationBuilder.AddColumn(
name: "SignupReward_CoinAmount",
table: "Config",
type: "int",
nullable: false,
defaultValue: 0,
comment: "지급 코인 (Airdrop)");
migrationBuilder.AddColumn(
name: "SignupReward_Enabled",
table: "Config",
type: "bit",
nullable: false,
defaultValue: false,
comment: "가입 축하 보상 활성화");
migrationBuilder.AddColumn(
name: "SignupReward_ExpAmount",
table: "Config",
type: "int",
nullable: false,
defaultValue: 0,
comment: "지급 경험치");
migrationBuilder.CreateTable(
name: "Attendance",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
MemberID = table.Column(type: "int", nullable: false, comment: "회원 ID"),
Greeting = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false, comment: "출석 인사"),
ConsecutiveDays = table.Column(type: "int", nullable: false, comment: "연속 출석 일수"),
ExpRewarded = table.Column(type: "int", nullable: false, comment: "지급 경험치"),
PointRewarded = table.Column(type: "int", nullable: false, comment: "지급 포인트"),
CreatedAt = table.Column(type: "datetime2", nullable: false, comment: "출석 일시")
},
constraints: table =>
{
table.PrimaryKey("PK_Attendance", x => x.ID);
table.ForeignKey(
name: "FK_Attendance_Member_MemberID",
column: x => x.MemberID,
principalTable: "Member",
principalColumn: "ID");
},
comment: "출석 기록");
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_Attendance_CreatedAt",
table: "Attendance",
column: "CreatedAt",
descending: new bool[0]);
migrationBuilder.CreateIndex(
name: "IX_Attendance_MemberID_CreatedAt",
table: "Attendance",
columns: new[] { "MemberID", "CreatedAt" },
descending: new[] { false, true });
migrationBuilder.CreateIndex(
name: "IX_MemberDailyRewardCounter_RewardDate",
table: "MemberDailyRewardCounter",
column: "RewardDate");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Attendance");
migrationBuilder.DropTable(
name: "MemberDailyRewardCounter");
migrationBuilder.DropColumn(
name: "Attendance_BaseExp",
table: "Config");
migrationBuilder.DropColumn(
name: "Attendance_BasePoint",
table: "Config");
migrationBuilder.DropColumn(
name: "Attendance_IsEnabled",
table: "Config");
migrationBuilder.DropColumn(
name: "Attendance_RankBonusConfig",
table: "Config");
migrationBuilder.DropColumn(
name: "Attendance_StreakBonusMaxDays",
table: "Config");
migrationBuilder.DropColumn(
name: "Attendance_StreakBonusPerDay",
table: "Config");
migrationBuilder.DropColumn(
name: "Attendance_StreakBonusPointPerDay",
table: "Config");
migrationBuilder.DropColumn(
name: "Attendance_UseRankBonus",
table: "Config");
migrationBuilder.DropColumn(
name: "Attendance_UseStreakBonus",
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_CommentExp",
table: "Config");
migrationBuilder.DropColumn(
name: "Reward_CommentPoint",
table: "Config");
migrationBuilder.DropColumn(
name: "Reward_LikeGivenDailyCount",
table: "Config");
migrationBuilder.DropColumn(
name: "Reward_LikeGivenDailyExp",
table: "Config");
migrationBuilder.DropColumn(
name: "Reward_LikeGivenExp",
table: "Config");
migrationBuilder.DropColumn(
name: "Reward_LikeReceivedDailyCount",
table: "Config");
migrationBuilder.DropColumn(
name: "Reward_LikeReceivedDailyPoint",
table: "Config");
migrationBuilder.DropColumn(
name: "Reward_LikeReceivedPoint",
table: "Config");
migrationBuilder.DropColumn(
name: "Reward_MinCommentLength",
table: "Config");
migrationBuilder.DropColumn(
name: "Reward_MinPostLength",
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_PostExp",
table: "Config");
migrationBuilder.DropColumn(
name: "Reward_PostPoint",
table: "Config");
migrationBuilder.DropColumn(
name: "SignupReward_CashAmount",
table: "Config");
migrationBuilder.DropColumn(
name: "SignupReward_CoinAmount",
table: "Config");
migrationBuilder.DropColumn(
name: "SignupReward_Enabled",
table: "Config");
migrationBuilder.DropColumn(
name: "SignupReward_ExpAmount",
table: "Config");
}
}
}