| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- namespace Infrastructure.Migrations.AppDb;
- /// <inheritdoc />
- public partial class AddAttendance : 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<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_UseStreakBonus",
- table: "Config",
- type: "bit",
- nullable: false,
- defaultValue: false,
- 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.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 });
- }
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "Attendance");
- 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_StreakBonusMaxDays",
- table: "Config");
- migrationBuilder.DropColumn(
- name: "Attendance_StreakBonusPerDay",
- table: "Config");
- migrationBuilder.DropColumn(
- name: "Attendance_StreakBonusPointPerDay",
- table: "Config");
- migrationBuilder.DropColumn(
- name: "Attendance_UseStreakBonus",
- table: "Config");
- }
- }
|