| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- namespace Infrastructure.Migrations.AppDb
- {
- /// <inheritdoc />
- public partial class AddRewardConfigDropActivityToken : Migration
- {
- /// <inheritdoc />
- 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<int>(name: "Reward_PostExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 작성 지급 경험치");
- migrationBuilder.AddColumn<int>(name: "Reward_PostPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 작성 지급 토큰");
- migrationBuilder.AddColumn<int>(name: "Reward_CommentExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 작성 지급 경험치");
- migrationBuilder.AddColumn<int>(name: "Reward_CommentPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 작성 지급 토큰");
- migrationBuilder.AddColumn<int>(name: "Reward_LikeGivenExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(누른 쪽) 지급 경험치");
- migrationBuilder.AddColumn<int>(name: "Reward_LikeReceivedPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(받은 쪽) 지급 토큰");
- migrationBuilder.AddColumn<int>(name: "Reward_MinPostLength", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "보상 지급 최소 게시글 길이 (0=제한 없음)");
- migrationBuilder.AddColumn<int>(name: "Reward_MinCommentLength", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "보상 지급 최소 댓글 길이 (0=제한 없음)");
- migrationBuilder.AddColumn<int>(name: "Reward_NewMemberHoldDays", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "신규 회원 보상 유예 기간(일, 0=유예 없음)");
- migrationBuilder.AddColumn<int>(name: "Reward_PostDailyCount", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 보상 일일 횟수 상한 (0=무제한)");
- migrationBuilder.AddColumn<int>(name: "Reward_PostDailyExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 보상 일일 경험치 상한 (0=무제한)");
- migrationBuilder.AddColumn<int>(name: "Reward_PostDailyPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 보상 일일 토큰 상한 (0=무제한)");
- migrationBuilder.AddColumn<int>(name: "Reward_CommentDailyCount", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 보상 일일 횟수 상한 (0=무제한)");
- migrationBuilder.AddColumn<int>(name: "Reward_CommentDailyExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 보상 일일 경험치 상한 (0=무제한)");
- migrationBuilder.AddColumn<int>(name: "Reward_CommentDailyPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 보상 일일 토큰 상한 (0=무제한)");
- migrationBuilder.AddColumn<int>(name: "Reward_LikeGivenDailyCount", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(누른 쪽) 보상 일일 횟수 상한 (0=무제한)");
- migrationBuilder.AddColumn<int>(name: "Reward_LikeGivenDailyExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(누른 쪽) 보상 일일 경험치 상한 (0=무제한)");
- migrationBuilder.AddColumn<int>(name: "Reward_LikeReceivedDailyCount", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(받은 쪽) 보상 일일 횟수 상한 (0=무제한)");
- migrationBuilder.AddColumn<int>(name: "Reward_LikeReceivedDailyPoint", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "추천(받은 쪽) 보상 일일 토큰 상한 (0=무제한)");
- migrationBuilder.AddColumn<int>(name: "Reward_ChatDailyCount", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "채팅 보상 일일 횟수 상한 (0=무제한)");
- migrationBuilder.AddColumn<int>(name: "Reward_ChatDailyExp", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "채팅 보상 일일 경험치 상한 (0=무제한)");
- // 일일 보상 캡 원장 (복합 PK)
- migrationBuilder.CreateTable(
- name: "MemberDailyRewardCounter",
- columns: table => new
- {
- MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
- RewardDate = table.Column<DateOnly>(type: "date", nullable: false, comment: "KST 기준 일자"),
- ActionType = table.Column<byte>(type: "tinyint", nullable: false, comment: "액션 유형 (Post=1..PaperReward=8)"),
- Count = table.Column<int>(type: "int", nullable: false, comment: "오늘 지급 횟수"),
- ExpTotal = table.Column<int>(type: "int", nullable: false, comment: "오늘 지급 경험치 합계"),
- PointTotal = table.Column<int>(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");
- }
- /// <inheritdoc />
- 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<int>(name: "ActivityToken_CommentToken", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "댓글 작성 지급 토큰");
- migrationBuilder.AddColumn<int>(name: "ActivityToken_DailyTokenCap", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "활동 토큰 일일 상한 (0=무제한)");
- migrationBuilder.AddColumn<int>(name: "ActivityToken_PostToken", table: "Config", type: "int", nullable: false, defaultValue: 0, comment: "게시글 작성 지급 토큰");
- }
- }
- }
|