20260416051717_AddAttendance.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Migrations.AppDb;
  5. /// <inheritdoc />
  6. public partial class AddAttendance : Migration
  7. {
  8. /// <inheritdoc />
  9. protected override void Up(MigrationBuilder migrationBuilder)
  10. {
  11. migrationBuilder.AddColumn<int>(
  12. name: "Attendance_BaseExp",
  13. table: "Config",
  14. type: "int",
  15. nullable: false,
  16. defaultValue: 0,
  17. comment: "기본 경험치");
  18. migrationBuilder.AddColumn<int>(
  19. name: "Attendance_BasePoint",
  20. table: "Config",
  21. type: "int",
  22. nullable: false,
  23. defaultValue: 0,
  24. comment: "기본 포인트");
  25. migrationBuilder.AddColumn<bool>(
  26. name: "Attendance_IsEnabled",
  27. table: "Config",
  28. type: "bit",
  29. nullable: false,
  30. defaultValue: false,
  31. comment: "출석 기능 활성화");
  32. migrationBuilder.AddColumn<int>(
  33. name: "Attendance_StreakBonusMaxDays",
  34. table: "Config",
  35. type: "int",
  36. nullable: false,
  37. defaultValue: 0,
  38. comment: "가중치 최대 적용 일수");
  39. migrationBuilder.AddColumn<int>(
  40. name: "Attendance_StreakBonusPerDay",
  41. table: "Config",
  42. type: "int",
  43. nullable: false,
  44. defaultValue: 0,
  45. comment: "1일당 추가 경험치");
  46. migrationBuilder.AddColumn<int>(
  47. name: "Attendance_StreakBonusPointPerDay",
  48. table: "Config",
  49. type: "int",
  50. nullable: false,
  51. defaultValue: 0,
  52. comment: "1일당 추가 포인트");
  53. migrationBuilder.AddColumn<bool>(
  54. name: "Attendance_UseStreakBonus",
  55. table: "Config",
  56. type: "bit",
  57. nullable: false,
  58. defaultValue: false,
  59. comment: "연속 출석 가중치 사용");
  60. migrationBuilder.CreateTable(
  61. name: "Attendance",
  62. columns: table => new
  63. {
  64. ID = table.Column<int>(type: "int", nullable: false)
  65. .Annotation("SqlServer:Identity", "1, 1"),
  66. MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
  67. Greeting = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false, comment: "출석 인사"),
  68. ConsecutiveDays = table.Column<int>(type: "int", nullable: false, comment: "연속 출석 일수"),
  69. ExpRewarded = table.Column<int>(type: "int", nullable: false, comment: "지급 경험치"),
  70. PointRewarded = table.Column<int>(type: "int", nullable: false, comment: "지급 포인트"),
  71. CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "출석 일시")
  72. },
  73. constraints: table =>
  74. {
  75. table.PrimaryKey("PK_Attendance", x => x.ID);
  76. table.ForeignKey(
  77. name: "FK_Attendance_Member_MemberID",
  78. column: x => x.MemberID,
  79. principalTable: "Member",
  80. principalColumn: "ID");
  81. },
  82. comment: "출석 기록");
  83. migrationBuilder.CreateIndex(
  84. name: "IX_Attendance_CreatedAt",
  85. table: "Attendance",
  86. column: "CreatedAt",
  87. descending: new bool[0]);
  88. migrationBuilder.CreateIndex(
  89. name: "IX_Attendance_MemberID_CreatedAt",
  90. table: "Attendance",
  91. columns: new[] { "MemberID", "CreatedAt" },
  92. descending: new[] { false, true });
  93. }
  94. /// <inheritdoc />
  95. protected override void Down(MigrationBuilder migrationBuilder)
  96. {
  97. migrationBuilder.DropTable(
  98. name: "Attendance");
  99. migrationBuilder.DropColumn(
  100. name: "Attendance_BaseExp",
  101. table: "Config");
  102. migrationBuilder.DropColumn(
  103. name: "Attendance_BasePoint",
  104. table: "Config");
  105. migrationBuilder.DropColumn(
  106. name: "Attendance_IsEnabled",
  107. table: "Config");
  108. migrationBuilder.DropColumn(
  109. name: "Attendance_StreakBonusMaxDays",
  110. table: "Config");
  111. migrationBuilder.DropColumn(
  112. name: "Attendance_StreakBonusPerDay",
  113. table: "Config");
  114. migrationBuilder.DropColumn(
  115. name: "Attendance_StreakBonusPointPerDay",
  116. table: "Config");
  117. migrationBuilder.DropColumn(
  118. name: "Attendance_UseStreakBonus",
  119. table: "Config");
  120. }
  121. }