using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations.AppDb;
///
public partial class AddAttendance : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "Attendance_BaseExp",
table: "Config",
type: "int",
nullable: false,
defaultValue: 0,
comment: "기본 경험치");
migrationBuilder.AddColumn(
name: "Attendance_BasePoint",
table: "Config",
type: "int",
nullable: false,
defaultValue: 0,
comment: "기본 포인트");
migrationBuilder.AddColumn(
name: "Attendance_IsEnabled",
table: "Config",
type: "bit",
nullable: false,
defaultValue: false,
comment: "출석 기능 활성화");
migrationBuilder.AddColumn(
name: "Attendance_StreakBonusMaxDays",
table: "Config",
type: "int",
nullable: false,
defaultValue: 0,
comment: "가중치 최대 적용 일수");
migrationBuilder.AddColumn(
name: "Attendance_StreakBonusPerDay",
table: "Config",
type: "int",
nullable: false,
defaultValue: 0,
comment: "1일당 추가 경험치");
migrationBuilder.AddColumn(
name: "Attendance_StreakBonusPointPerDay",
table: "Config",
type: "int",
nullable: false,
defaultValue: 0,
comment: "1일당 추가 포인트");
migrationBuilder.AddColumn(
name: "Attendance_UseStreakBonus",
table: "Config",
type: "bit",
nullable: false,
defaultValue: false,
comment: "연속 출석 가중치 사용");
migrationBuilder.CreateTable(
name: "Attendance",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
MemberID = table.Column(type: "int", nullable: false, comment: "회원 ID"),
Greeting = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false, comment: "출석 인사"),
ConsecutiveDays = table.Column(type: "int", nullable: false, comment: "연속 출석 일수"),
ExpRewarded = table.Column(type: "int", nullable: false, comment: "지급 경험치"),
PointRewarded = table.Column(type: "int", nullable: false, comment: "지급 포인트"),
CreatedAt = table.Column(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 });
}
///
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");
}
}