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