20260706000000_AddRewardConfigDropActivityToken.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Migrations.AppDb
  5. {
  6. /// <inheritdoc />
  7. public partial class AddRewardConfigDropActivityToken : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. // ActivityToken_* → Reward_* 통합 (d3 M2). 기존 3개 컬럼 드랍.
  13. migrationBuilder.DropColumn(name: "ActivityToken_CommentToken", table: "Config");
  14. migrationBuilder.DropColumn(name: "ActivityToken_DailyTokenCap", table: "Config");
  15. migrationBuilder.DropColumn(name: "ActivityToken_PostToken", table: "Config");
  16. // Reward_* 신규 컬럼
  17. migrationBuilder.AddColumn<int>(name: "Reward_PostExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 작성 지급 경험치");
  18. migrationBuilder.AddColumn<int>(name: "Reward_PostPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 작성 지급 토큰");
  19. migrationBuilder.AddColumn<int>(name: "Reward_CommentExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 작성 지급 경험치");
  20. migrationBuilder.AddColumn<int>(name: "Reward_CommentPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 작성 지급 토큰");
  21. migrationBuilder.AddColumn<int>(name: "Reward_LikeGivenExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(누른 쪽) 지급 경험치");
  22. migrationBuilder.AddColumn<int>(name: "Reward_LikeReceivedPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(받은 쪽) 지급 토큰");
  23. migrationBuilder.AddColumn<int>(name: "Reward_MinPostLength", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "보상 지급 최소 게시글 길이 (0=제한 없음)");
  24. migrationBuilder.AddColumn<int>(name: "Reward_MinCommentLength", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "보상 지급 최소 댓글 길이 (0=제한 없음)");
  25. migrationBuilder.AddColumn<int>(name: "Reward_NewMemberHoldDays", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "신규 회원 보상 유예 기간(일, 0=유예 없음)");
  26. migrationBuilder.AddColumn<int>(name: "Reward_PostDailyCount", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 보상 일일 횟수 상한 (0=무제한)");
  27. migrationBuilder.AddColumn<int>(name: "Reward_PostDailyExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 보상 일일 경험치 상한 (0=무제한)");
  28. migrationBuilder.AddColumn<int>(name: "Reward_PostDailyPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 보상 일일 토큰 상한 (0=무제한)");
  29. migrationBuilder.AddColumn<int>(name: "Reward_CommentDailyCount", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 보상 일일 횟수 상한 (0=무제한)");
  30. migrationBuilder.AddColumn<int>(name: "Reward_CommentDailyExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 보상 일일 경험치 상한 (0=무제한)");
  31. migrationBuilder.AddColumn<int>(name: "Reward_CommentDailyPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 보상 일일 토큰 상한 (0=무제한)");
  32. migrationBuilder.AddColumn<int>(name: "Reward_LikeGivenDailyCount", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(누른 쪽) 보상 일일 횟수 상한 (0=무제한)");
  33. migrationBuilder.AddColumn<int>(name: "Reward_LikeGivenDailyExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(누른 쪽) 보상 일일 경험치 상한 (0=무제한)");
  34. migrationBuilder.AddColumn<int>(name: "Reward_LikeReceivedDailyCount", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(받은 쪽) 보상 일일 횟수 상한 (0=무제한)");
  35. migrationBuilder.AddColumn<int>(name: "Reward_LikeReceivedDailyPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(받은 쪽) 보상 일일 토큰 상한 (0=무제한)");
  36. migrationBuilder.AddColumn<int>(name: "Reward_ChatDailyCount", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "채팅 보상 일일 횟수 상한 (0=무제한)");
  37. migrationBuilder.AddColumn<int>(name: "Reward_ChatDailyExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "채팅 보상 일일 경험치 상한 (0=무제한)");
  38. // 일일 보상 캡 원장 (복합 PK)
  39. migrationBuilder.CreateTable(
  40. name: "MemberDailyRewardCounter",
  41. columns: table => new
  42. {
  43. MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
  44. RewardDate = table.Column<DateOnly>(type: "date", nullable: false, comment: "KST 기준 일자"),
  45. ActionType = table.Column<byte>(type: "tinyint", nullable: false, comment: "액션 유형 (Post=1..PaperReward=8)"),
  46. Count = table.Column<int>(type: "int", nullable: false, comment: "오늘 지급 횟수"),
  47. ExpTotal = table.Column<int>(type: "int", nullable: false, comment: "오늘 지급 경험치 합계"),
  48. PointTotal = table.Column<int>(type: "int", nullable: false, comment: "오늘 지급 토큰 합계")
  49. },
  50. constraints: table =>
  51. {
  52. table.PrimaryKey("PK_MemberDailyRewardCounter", x => new { x.MemberID, x.RewardDate, x.ActionType });
  53. table.ForeignKey(
  54. name: "FK_MemberDailyRewardCounter_Member_MemberID",
  55. column: x => x.MemberID,
  56. principalTable: "Member",
  57. principalColumn: "ID",
  58. onDelete: ReferentialAction.Cascade);
  59. },
  60. comment: "일일 보상 캡 원장 (d3 M2)");
  61. migrationBuilder.CreateIndex(
  62. name: "IX_MemberDailyRewardCounter_RewardDate",
  63. table: "MemberDailyRewardCounter",
  64. column: "RewardDate");
  65. }
  66. /// <inheritdoc />
  67. protected override void Down(MigrationBuilder migrationBuilder)
  68. {
  69. migrationBuilder.DropTable(name: "MemberDailyRewardCounter");
  70. migrationBuilder.DropColumn(name: "Reward_PostExp", table: "Config");
  71. migrationBuilder.DropColumn(name: "Reward_PostPoint", table: "Config");
  72. migrationBuilder.DropColumn(name: "Reward_CommentExp", table: "Config");
  73. migrationBuilder.DropColumn(name: "Reward_CommentPoint", table: "Config");
  74. migrationBuilder.DropColumn(name: "Reward_LikeGivenExp", table: "Config");
  75. migrationBuilder.DropColumn(name: "Reward_LikeReceivedPoint", table: "Config");
  76. migrationBuilder.DropColumn(name: "Reward_MinPostLength", table: "Config");
  77. migrationBuilder.DropColumn(name: "Reward_MinCommentLength", table: "Config");
  78. migrationBuilder.DropColumn(name: "Reward_NewMemberHoldDays", table: "Config");
  79. migrationBuilder.DropColumn(name: "Reward_PostDailyCount", table: "Config");
  80. migrationBuilder.DropColumn(name: "Reward_PostDailyExp", table: "Config");
  81. migrationBuilder.DropColumn(name: "Reward_PostDailyPoint", table: "Config");
  82. migrationBuilder.DropColumn(name: "Reward_CommentDailyCount", table: "Config");
  83. migrationBuilder.DropColumn(name: "Reward_CommentDailyExp", table: "Config");
  84. migrationBuilder.DropColumn(name: "Reward_CommentDailyPoint", table: "Config");
  85. migrationBuilder.DropColumn(name: "Reward_LikeGivenDailyCount", table: "Config");
  86. migrationBuilder.DropColumn(name: "Reward_LikeGivenDailyExp", table: "Config");
  87. migrationBuilder.DropColumn(name: "Reward_LikeReceivedDailyCount", table: "Config");
  88. migrationBuilder.DropColumn(name: "Reward_LikeReceivedDailyPoint", table: "Config");
  89. migrationBuilder.DropColumn(name: "Reward_ChatDailyCount", table: "Config");
  90. migrationBuilder.DropColumn(name: "Reward_ChatDailyExp", table: "Config");
  91. // 롤백: ActivityToken_* 복원
  92. migrationBuilder.AddColumn<int>(name: "ActivityToken_CommentToken", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 작성 지급 토큰");
  93. migrationBuilder.AddColumn<int>(name: "ActivityToken_DailyTokenCap", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "활동 토큰 일일 상한 (0=무제한)");
  94. migrationBuilder.AddColumn<int>(name: "ActivityToken_PostToken", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 작성 지급 토큰");
  95. }
  96. }
  97. }