using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Infrastructure.Persistence.Migrations
{
    /// <inheritdoc />
    public partial class Init : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "BannerPosition",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Code = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false, comment: "위치 구분"),
                    Subject = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "위치 명"),
                    IsActive = table.Column<bool>(type: "bit", nullable: false, comment: "사용 여부"),
                    UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BannerPosition", x => x.ID);
                },
                comment: "배너 위치");

            migrationBuilder.CreateTable(
                name: "Config",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    LastUpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "마지막 수정일시"),
                    RowVersion = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: false, comment: "동시성 제어용"),
                    Basic_SiteName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "사이트 이름"),
                    Basic_RootID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "최고 관리자 ID"),
                    Basic_FromEmail = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true, comment: "송수신 이메일"),
                    Basic_FromName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "송수신자 이름"),
                    Basic_SmtpServer = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true, comment: "SMTP Server"),
                    Basic_SmtpPort = table.Column<int>(type: "int", nullable: true, comment: "SMTP Port"),
                    Basic_SmtpEnableSSL = table.Column<bool>(type: "bit", nullable: true, comment: "SMTP Enable SSL"),
                    Basic_SmtpUsername = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true, comment: "SMTP Username"),
                    Basic_SmtpPassword = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "SMTP Password (암호화 저장 권장)"),
                    Basic_AdminWhiteIPList = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "관리자단 접근 가능 IP"),
                    Basic_FrontWhiteIPList = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "사용자단 접근 가능 IP"),
                    Basic_BlockAlertTitle = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true, comment: "차단 시 안내문 제목"),
                    Basic_BlockAlertContent = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "차단 시 안내문 내용"),
                    Basic_IsMaintenance = table.Column<bool>(type: "bit", nullable: false, comment: "점검 여부"),
                    Basic_MaintenanceContent = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "점검 내용"),
                    Meta_Keywords = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "Meta Keywords"),
                    Meta_Description = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "Meta Description"),
                    Meta_Author = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "Meta Author"),
                    Meta_Viewport = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "Meta Viewport"),
                    Meta_ApplicationName = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "Meta Application Name"),
                    Meta_Generator = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "Meta Generator"),
                    Meta_Robots = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "Meta Robots"),
                    Meta_Adds = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Company_Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Company_RegNo = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Company_Owner = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Company_Tel = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Company_Fax = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Company_RetailSaleNo = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Company_AddedSaleNo = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Company_ZipCode = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, comment: "사업장 주소(우편번호)"),
                    Company_Hosting = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true, comment: "호스팅 서비스"),
                    Company_AdminName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "정보관리책임자"),
                    Company_AdminEmail = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true, comment: "정보관리책임자 E-mail"),
                    Company_SiteUrl = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true, comment: "사이트 주소"),
                    Company_BankCode = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, comment: "입금 계좌(은행 코드)"),
                    Company_BankOwner = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "예금주"),
                    Company_BankNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "계좌번호"),
                    Account_IsRegisterBlock = table.Column<bool>(type: "bit", nullable: false, comment: "회원가입 차단"),
                    Account_IsRegisterEmailAuth = table.Column<bool>(type: "bit", nullable: false, comment: "회원가입 시 이메일 인증"),
                    Account_PasswordMinLength = table.Column<int>(type: "int", nullable: true, comment: "비밀번호 최소 길이"),
                    Account_PasswordUppercaseLength = table.Column<int>(type: "int", nullable: true, comment: "비밀번호 최소 대문자 수"),
                    Account_PasswordNumbersLength = table.Column<int>(type: "int", nullable: true, comment: "비밀번호 최소 숫자 수"),
                    Account_PasswordSpecialcharsLength = table.Column<int>(type: "int", nullable: true, comment: "비밀번호 최소 특수문자 수"),
                    Account_DeniedEmailList = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "금지 이메일"),
                    Account_DeniedNameList = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "금지 별명"),
                    Account_ChangeEmailDay = table.Column<int>(type: "int", nullable: true, comment: "이메일 갱신 주기(일)"),
                    Account_ChangeNameDay = table.Column<int>(type: "int", nullable: true, comment: "별명 갱신 주기(일)"),
                    Account_ChangeSummaryDay = table.Column<int>(type: "int", nullable: true, comment: "한마디 갱신 주기(일)"),
                    Account_ChangeIntroDay = table.Column<int>(type: "int", nullable: true, comment: "자기소개 갱신 주기(일)"),
                    Account_ChangePasswordDay = table.Column<int>(type: "int", nullable: true, comment: "비밀번호 갱신 주기(일)"),
                    Account_MaxLoginTryCount = table.Column<int>(type: "int", nullable: true, comment: "로그인 시도 제한 횟수"),
                    Account_MaxLoginTryLimitSecond = table.Column<int>(type: "int", nullable: true, comment: "로그인 시도 제한 시간(초)"),
                    EmailTemplate_RegisterEmailFormTitle = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "회원가입 시 - 제목"),
                    EmailTemplate_RegisterEmailFormContent = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "회원가입 시 - 내용"),
                    EmailTemplate_RegistrationEmailFormTitle = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "회원가입 완료 - 제목"),
                    EmailTemplate_RegistrationEmailFormContent = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "회원가입 완료 - 내용"),
                    EmailTemplate_ResetPasswordEmailFormTitle = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "비밀번호 재설정 - 제목"),
                    EmailTemplate_ResetPasswordEmailFormContent = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "비밀번호 재설정 - 내용"),
                    EmailTemplate_ChangedPasswordEmailFormTitle = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "비밀번호 변경 완료 - 제목"),
                    EmailTemplate_ChangedPasswordEmailFormContent = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "비밀번호 변경 완료 - 내용"),
                    EmailTemplate_WithdrawEmailFormTitle = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "회원탈퇴 시 - 제목"),
                    EmailTemplate_WithdrawEmailFormContent = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "회원탈퇴 시 - 내용"),
                    EmailTemplate_EmailVerifyFormTitle = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "이메일 변경 시 - 제목"),
                    EmailTemplate_EmailVerifyFormContent = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "이메일 변경 시 - 내용"),
                    EmailTemplate_ChangedEmailFormTitle = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "이메일 변경 완료 - 제목"),
                    EmailTemplate_ChangedEmailFormContent = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "이메일 변경 완료 - 내용"),
                    External_YouTubeApiKeyEnc = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "YouTube API Key (암호화 저장 권장)"),
                    External_YouTubeApiName = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "YouTube API Name"),
                    External_GoogleClientId = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "Google Client ID"),
                    External_GoogleClientSecretEnc = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "Google Client Secret (암호화 저장 권장)"),
                    External_GoogleAppId = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "Google APP ID")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Config", x => x.ID);
                },
                comment: "운영 정보 설정 값");

            migrationBuilder.CreateTable(
                name: "Document",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Code = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false, comment: "주소"),
                    Subject = table.Column<string>(type: "nvarchar(120)", maxLength: 120, nullable: false, comment: "제목"),
                    Content = table.Column<string>(type: "nvarchar(max)", maxLength: 5000, nullable: true, comment: "내용"),
                    IsActive = table.Column<bool>(type: "bit", nullable: false, comment: "사용 여부"),
                    Views = table.Column<int>(type: "int", nullable: false, comment: "조회 수"),
                    UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Document", x => x.ID);
                },
                comment: "문서");

            migrationBuilder.CreateTable(
                name: "EmailVerifyNumber",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Type = table.Column<int>(type: "int", nullable: false, comment: "인증 유형 (이메일 인증 / 비밀번호 재설정)"),
                    Email = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: false, comment: "이메일"),
                    Code = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false, comment: "Code"),
                    IsVerified = table.Column<bool>(type: "bit", nullable: false, comment: "인증 여부"),
                    Expiration = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "만료 일시"),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmailVerifyNumber", x => x.ID);
                },
                comment: "이메일 인증 번호들");

            migrationBuilder.CreateTable(
                name: "EmailVerifyToken",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Type = table.Column<int>(type: "int", nullable: false, comment: "인증 유형 (이메일 인증 / 비밀번호 재설정)"),
                    Email = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: false, comment: "이메일"),
                    Token = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false, comment: "Token"),
                    IsVerified = table.Column<bool>(type: "bit", nullable: false, comment: "인증 여부"),
                    Expiration = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "만료 일시"),
                    Additional = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "추가 정보(JSON)"),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmailVerifyToken", x => x.ID);
                },
                comment: "이메일 인증 토큰들");

            migrationBuilder.CreateTable(
                name: "FaqCategory",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Code = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false, comment: "주소"),
                    Subject = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "분류 명"),
                    Order = table.Column<short>(type: "smallint", nullable: false, comment: "순서"),
                    IsActive = table.Column<bool>(type: "bit", nullable: false, comment: "사용 여부"),
                    UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_FaqCategory", x => x.ID);
                },
                comment: "FAQ 분류");

            migrationBuilder.CreateTable(
                name: "MemberGrade",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    KorName = table.Column<string>(type: "nvarchar(240)", maxLength: 240, nullable: false, comment: "한글 명"),
                    EngName = table.Column<string>(type: "nvarchar(120)", maxLength: 120, nullable: false, comment: "영문 명"),
                    Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true, comment: "설명"),
                    Order = table.Column<short>(type: "smallint", nullable: false, comment: "순서"),
                    Image = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true, comment: "이미지"),
                    RequiredExp = table.Column<int>(type: "int", nullable: false, comment: "누적 경험치"),
                    RequiredAttendance = table.Column<long>(type: "bigint", nullable: false, comment: "누적 출석 수"),
                    IsActive = table.Column<bool>(type: "bit", nullable: false, comment: "사용 여부"),
                    UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MemberGrade", x => x.ID);
                },
                comment: "회원 등급");

            migrationBuilder.CreateTable(
                name: "Popup",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Subject = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "제목"),
                    Content = table.Column<string>(type: "nvarchar(4000)", maxLength: 4000, nullable: true, comment: "내용"),
                    Link = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "주소"),
                    StartAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "사용 기간 - 시작"),
                    EndAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "사용 기간 - 종료"),
                    Order = table.Column<short>(type: "smallint", nullable: false, comment: "순서"),
                    IsActive = table.Column<bool>(type: "bit", nullable: false, comment: "사용 여부"),
                    UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Popup", x => x.ID);
                },
                comment: "팝업");

            migrationBuilder.CreateTable(
                name: "BannerItem",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    PositionID = table.Column<int>(type: "int", nullable: false, comment: "배너 위치 ID"),
                    Subject = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "배너 명"),
                    DesktopImage = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true, comment: "이미지(Desktop)"),
                    MobileImage = table.Column<string>(type: "nvarchar(1024)", maxLength: 1024, nullable: true, comment: "이미지(Mobile)"),
                    Link = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "주소"),
                    Order = table.Column<short>(type: "smallint", nullable: false, comment: "순서"),
                    IsActive = table.Column<bool>(type: "bit", nullable: false, comment: "사용 여부"),
                    StartAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "사용 기간 - 시작"),
                    EndAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "사용 기간 - 종료"),
                    UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BannerItem", x => x.ID);
                    table.ForeignKey(
                        name: "FK_BannerItem_BannerPosition_PositionID",
                        column: x => x.PositionID,
                        principalTable: "BannerPosition",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "배너 아이템");

            migrationBuilder.CreateTable(
                name: "FaqItem",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CategoryID = table.Column<int>(type: "int", nullable: false, comment: "분류 ID"),
                    Question = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "질문"),
                    Answer = table.Column<string>(type: "nvarchar(4000)", maxLength: 4000, nullable: true, comment: "답변"),
                    Order = table.Column<short>(type: "smallint", nullable: false, comment: "순서"),
                    IsActive = table.Column<bool>(type: "bit", nullable: false, comment: "사용 여부"),
                    UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_FaqItem", x => x.ID);
                    table.ForeignKey(
                        name: "FK_FaqItem_FaqCategory_CategoryID",
                        column: x => x.CategoryID,
                        principalTable: "FaqCategory",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "FAQ 목록");

            migrationBuilder.CreateTable(
                name: "Member",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    MemberGradeID = table.Column<int>(type: "int", nullable: true, comment: "회원등급 PK"),
                    SID = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false, comment: "SID"),
                    Email = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: false, comment: "이메일"),
                    Name = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, comment: "별명"),
                    FullName = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true, comment: "본명"),
                    FirstName = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, comment: "본명(성)"),
                    LastName = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true, comment: "본명(이름)"),
                    Password = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "비밀번호"),
                    Intro = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true, comment: "자기소개"),
                    Summary = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "한마디"),
                    Phone = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: true, comment: "연락처"),
                    Birthday = table.Column<DateOnly>(type: "date", nullable: true, comment: "생년월일"),
                    Gender = table.Column<int>(type: "int", nullable: true, comment: "성별"),
                    Thunmbnail = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "썸네일"),
                    Icon = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "아이콘"),
                    IsEmailVerified = table.Column<bool>(type: "bit", nullable: false, comment: "이메일 인증 여부"),
                    IsAuthCertified = table.Column<bool>(type: "bit", nullable: false, comment: "본인 인증 여부"),
                    IsDenied = table.Column<bool>(type: "bit", nullable: false, comment: "차단 여부"),
                    IsAdmin = table.Column<bool>(type: "bit", nullable: false, comment: "운영진 여부"),
                    IsWithdraw = table.Column<bool>(type: "bit", nullable: false, comment: "탈퇴 여부"),
                    IsCreator = table.Column<bool>(type: "bit", nullable: false, comment: "크리에이터 여부"),
                    DeviceInfo = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: true, comment: "로그인 단말기 정보"),
                    SignupIP = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: true, comment: "회원가입 시 IP"),
                    LastLoginIp = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: true, comment: "마지막 로그인 IP"),
                    IpAddress = table.Column<string>(type: "nvarchar(45)", maxLength: 45, nullable: true, comment: "IP Address"),
                    UserAgent = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true, comment: "User-agent"),
                    LastLoginAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "마지막 로그인 일시"),
                    LastEmailChangedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "마지막 이메일 변경 일시"),
                    LastNameChangedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "마지막 별명 변경 일시"),
                    LastSummaryChangedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "마지막 한마디 변경 일시"),
                    LastIntroChangedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "마지막 자기소개 변경 일시"),
                    EmailVerifiedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "이메일 인증 일시"),
                    AuthCertifiedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "본인인증 일시"),
                    PasswordUpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "비밀번호 변경 일시"),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "가입 일시"),
                    UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
                    DeletedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "탈퇴 일시"),
                    DeniedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "차단 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Member", x => x.ID);
                    table.ForeignKey(
                        name: "FK_Member_MemberGrade_MemberGradeID",
                        column: x => x.MemberGradeID,
                        principalTable: "MemberGrade",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.SetNull);
                },
                comment: "회원 정보");

            migrationBuilder.CreateTable(
                name: "Channel",
                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"),
                    SID = table.Column<string>(type: "nvarchar(24)", maxLength: 24, nullable: false, comment: "채널 ID"),
                    Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false, comment: "채널 이름"),
                    Handle = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: true, comment: "핸들"),
                    YouTubeUrl = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false, comment: "YouTube 채널 URL"),
                    PlatformFeeRate = table.Column<decimal>(type: "decimal(5,2)", precision: 5, scale: 2, nullable: false, comment: "수수료(%)"),
                    IsVerified = table.Column<bool>(type: "bit", nullable: false, comment: "인증 여부"),
                    IsActive = table.Column<bool>(type: "bit", nullable: false, comment: "활성 여부"),
                    UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "수정 일시"),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Channel", x => x.ID);
                    table.ForeignKey(
                        name: "FK_Channel_Member_MemberID",
                        column: x => x.MemberID,
                        principalTable: "Member",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "채널 정보");

            migrationBuilder.CreateTable(
                name: "MemberApprove",
                columns: table => new
                {
                    MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
                    IsReceiveSMS = table.Column<bool>(type: "bit", nullable: false, comment: "SMS 수신 여부"),
                    ReceiveSMSConsentAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "SMS 수신 동의 일시"),
                    IsReceiveEmail = table.Column<bool>(type: "bit", nullable: false, comment: "E-MAIL 수신 여부"),
                    ReceiveEmailConsentAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "E-MAIL 수신 동의 일시"),
                    IsReceiveNote = table.Column<bool>(type: "bit", nullable: false, comment: "쪽지 수신 여부"),
                    ReceiveNoteConsentAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "쪽지 수신 동의 일시"),
                    IsDisclosureInvest = table.Column<bool>(type: "bit", nullable: false, comment: "투자 현황 공개 여부"),
                    DisclosureInvestConsentAt = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "투자 현황 공개 동의 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MemberApprove", x => x.MemberID);
                    table.ForeignKey(
                        name: "FK_MemberApprove_Member_MemberID",
                        column: x => x.MemberID,
                        principalTable: "Member",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "회원 동의 및 수신 여부");

            migrationBuilder.CreateTable(
                name: "MemberEmailChangeLog",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
                    BeforeEmail = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: true, comment: "이전 이메일"),
                    AfterEmail = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: false, comment: "바뀐 이메일"),
                    Referer = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "이전 페이지 주소"),
                    IpAddress = table.Column<string>(type: "nvarchar(45)", maxLength: 45, nullable: true, comment: "IP Address"),
                    UserAgent = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true, comment: "User Agent"),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MemberEmailChangeLog", x => x.ID);
                    table.ForeignKey(
                        name: "FK_MemberEmailChangeLog_Member_MemberID",
                        column: x => x.MemberID,
                        principalTable: "Member",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "사용자 이메일 변경 내역");

            migrationBuilder.CreateTable(
                name: "MemberIntroChangeLog",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
                    BeforeIntro = table.Column<string>(type: "nvarchar(3000)", maxLength: 3000, nullable: true, comment: "이전 자기소개"),
                    AfterIntro = table.Column<string>(type: "nvarchar(3000)", maxLength: 3000, nullable: true, comment: "바꾼 자기소개"),
                    Referer = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "이전 페이지 주소"),
                    IpAddress = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: true, comment: "IP Address"),
                    UserAgent = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true, comment: "User Agent"),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MemberIntroChangeLog", x => x.ID);
                    table.ForeignKey(
                        name: "FK_MemberIntroChangeLog_Member_MemberID",
                        column: x => x.MemberID,
                        principalTable: "Member",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "자기소개 변경 내역");

            migrationBuilder.CreateTable(
                name: "MemberLoginLog",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    MemberID = table.Column<int>(type: "int", nullable: true, comment: "회원 ID"),
                    Success = table.Column<bool>(type: "bit", nullable: false, comment: "로그인 성공 여부 (0: 실패, 1: 성공)"),
                    Account = table.Column<string>(type: "nvarchar(120)", maxLength: 120, nullable: false, comment: "로그인 시도한 계정"),
                    Reason = table.Column<string>(type: "nvarchar(225)", maxLength: 225, nullable: true, comment: "실패 이유"),
                    Referer = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "이전 페이지 주소"),
                    Url = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true, comment: "요청 주소"),
                    IpAddress = table.Column<string>(type: "nvarchar(45)", maxLength: 45, nullable: true, comment: "IP Address"),
                    UserAgent = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true, comment: "User Agent"),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MemberLoginLog", x => x.ID);
                    table.ForeignKey(
                        name: "FK_MemberLoginLog_Member_MemberID",
                        column: x => x.MemberID,
                        principalTable: "Member",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.SetNull);
                },
                comment: "로그인 기록");

            migrationBuilder.CreateTable(
                name: "MemberNameChangeLog",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
                    BeforeName = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true, comment: "이전 별명"),
                    AfterName = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true, comment: "바꾼 별명"),
                    Referer = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "이전 페이지 주소"),
                    IpAddress = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: true, comment: "IP Address"),
                    UserAgent = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true, comment: "User Agent"),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MemberNameChangeLog", x => x.ID);
                    table.ForeignKey(
                        name: "FK_MemberNameChangeLog_Member_MemberID",
                        column: x => x.MemberID,
                        principalTable: "Member",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "별명 변경 내역");

            migrationBuilder.CreateTable(
                name: "MemberStats",
                columns: table => new
                {
                    MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
                    RowVersion = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: false, comment: "동시성"),
                    Exp = table.Column<long>(type: "bigint", nullable: false, comment: "경험치"),
                    PostCount = table.Column<long>(type: "bigint", nullable: false, comment: "작성 게시글"),
                    CommentCount = table.Column<long>(type: "bigint", nullable: false, comment: "작성 댓글"),
                    LikeReceivedCount = table.Column<long>(type: "bigint", nullable: false, comment: "받은 좋아요 수"),
                    LikeGivenCount = table.Column<long>(type: "bigint", nullable: false, comment: "누른 좋아요 수"),
                    ReportedCount = table.Column<long>(type: "bigint", nullable: false, comment: "신고 당한 횟수"),
                    BookmarkGivenCount = table.Column<long>(type: "bigint", nullable: false, comment: "즐겨찾기 글 수"),
                    WarningCount = table.Column<int>(type: "int", nullable: false, comment: "경고 횟수"),
                    SuspensionCount = table.Column<int>(type: "int", nullable: false, comment: "정지 횟수"),
                    LoginCount = table.Column<long>(type: "bigint", nullable: false, comment: "로그인"),
                    AttendanceCount = table.Column<long>(type: "bigint", nullable: false, comment: "출석"),
                    FollowingCount = table.Column<long>(type: "bigint", nullable: false, comment: "구독 중"),
                    FollowerCount = table.Column<long>(type: "bigint", nullable: false, comment: "구독자"),
                    PaymentCount = table.Column<long>(type: "bigint", nullable: false, comment: "결제 횟수"),
                    TotalPaidAmount = table.Column<long>(type: "bigint", nullable: false, comment: "누적 결제 금액"),
                    TotalCanceledAmount = table.Column<long>(type: "bigint", nullable: false, comment: "누적 취소/환불 금액")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MemberStats", x => x.MemberID);
                    table.ForeignKey(
                        name: "FK_MemberStats_Member_MemberID",
                        column: x => x.MemberID,
                        principalTable: "Member",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "회원 활동 집계");

            migrationBuilder.CreateTable(
                name: "MemberSummaryChangeLog",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false, comment: "PK")
                        .Annotation("SqlServer:Identity", "1, 1"),
                    MemberID = table.Column<int>(type: "int", nullable: false, comment: "회원 ID"),
                    BeforeSummary = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "이전 한마디"),
                    AfterSummary = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "바꾼 한마디"),
                    Referer = table.Column<string>(type: "nvarchar(max)", nullable: true, comment: "이전 페이지 주소"),
                    IpAddress = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: true, comment: "IP Address"),
                    UserAgent = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true, comment: "User Agent"),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, comment: "등록 일시")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MemberSummaryChangeLog", x => x.ID);
                    table.ForeignKey(
                        name: "FK_MemberSummaryChangeLog_Member_MemberID",
                        column: x => x.MemberID,
                        principalTable: "Member",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "한마디 변경 내역");

            migrationBuilder.CreateTable(
                name: "Wallet",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WalletKey = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    MemberID = table.Column<int>(type: "int", nullable: false),
                    UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Wallet", x => x.ID);
                    table.UniqueConstraint("AK_Wallet_WalletKey", x => x.WalletKey);
                    table.ForeignKey(
                        name: "FK_Wallet_Member_MemberID",
                        column: x => x.MemberID,
                        principalTable: "Member",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "회원 지갑");

            migrationBuilder.CreateTable(
                name: "WalletBalance",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WalletKey = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Type = table.Column<int>(type: "int", nullable: false),
                    Amount = table.Column<decimal>(type: "decimal(18,0)", precision: 18, scale: 0, nullable: false),
                    Currency = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WalletBalance", x => x.ID);
                    table.ForeignKey(
                        name: "FK_WalletBalance_Wallet_WalletKey",
                        column: x => x.WalletKey,
                        principalTable: "Wallet",
                        principalColumn: "WalletKey",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "회원 지갑 잔액");

            migrationBuilder.CreateTable(
                name: "WalletTransaction",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    WalletKey = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    BalanceType = table.Column<int>(type: "int", nullable: false),
                    TxType = table.Column<int>(type: "int", nullable: false),
                    Amount = table.Column<decimal>(type: "decimal(18,0)", precision: 18, scale: 0, nullable: false),
                    Currency = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
                    BalanceAfter = table.Column<decimal>(type: "decimal(18,0)", precision: 18, scale: 0, nullable: false),
                    BalanceAfterCurrency = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
                    Reason = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
                    RefID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    UserID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Memo = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WalletTransaction", x => x.ID);
                    table.ForeignKey(
                        name: "FK_WalletTransaction_Wallet_WalletKey",
                        column: x => x.WalletKey,
                        principalTable: "Wallet",
                        principalColumn: "WalletKey",
                        onDelete: ReferentialAction.Cascade);
                },
                comment: "회원 거래 장부");

            migrationBuilder.CreateIndex(
                name: "IX_BannerItem_IsActive",
                table: "BannerItem",
                column: "IsActive");

            migrationBuilder.CreateIndex(
                name: "IX_BannerItem_Order",
                table: "BannerItem",
                column: "Order");

            migrationBuilder.CreateIndex(
                name: "IX_BannerItem_PositionID",
                table: "BannerItem",
                column: "PositionID");

            migrationBuilder.CreateIndex(
                name: "IX_BannerItem_PositionID_Order_IsActive",
                table: "BannerItem",
                columns: new[] { "PositionID", "Order", "IsActive" });

            migrationBuilder.CreateIndex(
                name: "IX_BannerPosition_Code",
                table: "BannerPosition",
                column: "Code",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_BannerPosition_Code_IsActive",
                table: "BannerPosition",
                columns: new[] { "Code", "IsActive" });

            migrationBuilder.CreateIndex(
                name: "IX_BannerPosition_IsActive",
                table: "BannerPosition",
                column: "IsActive");

            migrationBuilder.CreateIndex(
                name: "IX_Channel_Handle",
                table: "Channel",
                column: "Handle",
                unique: true,
                filter: "[Handle] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_Channel_MemberID",
                table: "Channel",
                column: "MemberID",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Channel_MemberID_IsActive",
                table: "Channel",
                columns: new[] { "MemberID", "IsActive" });

            migrationBuilder.CreateIndex(
                name: "IX_Channel_MemberID_IsVerified",
                table: "Channel",
                columns: new[] { "MemberID", "IsVerified" });

            migrationBuilder.CreateIndex(
                name: "IX_Channel_MemberID_IsVerified_IsActive",
                table: "Channel",
                columns: new[] { "MemberID", "IsVerified", "IsActive" });

            migrationBuilder.CreateIndex(
                name: "IX_Channel_Name",
                table: "Channel",
                column: "Name",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Channel_SID",
                table: "Channel",
                column: "SID",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Channel_YouTubeUrl",
                table: "Channel",
                column: "YouTubeUrl",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Document_Code",
                table: "Document",
                column: "Code",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Document_Code_IsActive",
                table: "Document",
                columns: new[] { "Code", "IsActive" });

            migrationBuilder.CreateIndex(
                name: "IX_Document_IsActive",
                table: "Document",
                column: "IsActive");

            migrationBuilder.CreateIndex(
                name: "IX_Document_Subject",
                table: "Document",
                column: "Subject");

            migrationBuilder.CreateIndex(
                name: "IX_EmailVerifyNumber_Code",
                table: "EmailVerifyNumber",
                column: "Code");

            migrationBuilder.CreateIndex(
                name: "IX_EmailVerifyNumber_Email",
                table: "EmailVerifyNumber",
                column: "Email");

            migrationBuilder.CreateIndex(
                name: "IX_EmailVerifyNumber_Expiration",
                table: "EmailVerifyNumber",
                column: "Expiration");

            migrationBuilder.CreateIndex(
                name: "IX_EmailVerifyNumber_IsVerified",
                table: "EmailVerifyNumber",
                column: "IsVerified");

            migrationBuilder.CreateIndex(
                name: "IX_EmailVerifyNumber_Type",
                table: "EmailVerifyNumber",
                column: "Type");

            migrationBuilder.CreateIndex(
                name: "IX_EmailVerifyNumber_Type_Code",
                table: "EmailVerifyNumber",
                columns: new[] { "Type", "Code" });

            migrationBuilder.CreateIndex(
                name: "IX_EmailVerifyNumber_Type_Code_IsVerified",
                table: "EmailVerifyNumber",
                columns: new[] { "Type", "Code", "IsVerified" });

            migrationBuilder.CreateIndex(
                name: "IX_EmailVerifyToken_Email",
                table: "EmailVerifyToken",
                column: "Email");

            migrationBuilder.CreateIndex(
                name: "IX_EmailVerifyToken_Expiration",
                table: "EmailVerifyToken",
                column: "Expiration");

            migrationBuilder.CreateIndex(
                name: "IX_EmailVerifyToken_IsVerified",
                table: "EmailVerifyToken",
                column: "IsVerified");

            migrationBuilder.CreateIndex(
                name: "IX_EmailVerifyToken_Token",
                table: "EmailVerifyToken",
                column: "Token");

            migrationBuilder.CreateIndex(
                name: "IX_EmailVerifyToken_Type",
                table: "EmailVerifyToken",
                column: "Type");

            migrationBuilder.CreateIndex(
                name: "IX_EmailVerifyToken_Type_Email_Token",
                table: "EmailVerifyToken",
                columns: new[] { "Type", "Email", "Token" });

            migrationBuilder.CreateIndex(
                name: "IX_EmailVerifyToken_Type_Email_Token_IsVerified",
                table: "EmailVerifyToken",
                columns: new[] { "Type", "Email", "Token", "IsVerified" });

            migrationBuilder.CreateIndex(
                name: "IX_FaqCategory_Code",
                table: "FaqCategory",
                column: "Code",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_FaqCategory_Code_Order_IsActive",
                table: "FaqCategory",
                columns: new[] { "Code", "Order", "IsActive" });

            migrationBuilder.CreateIndex(
                name: "IX_FaqCategory_Order_IsActive",
                table: "FaqCategory",
                columns: new[] { "Order", "IsActive" });

            migrationBuilder.CreateIndex(
                name: "IX_FaqItem_CategoryID",
                table: "FaqItem",
                column: "CategoryID");

            migrationBuilder.CreateIndex(
                name: "IX_FaqItem_CategoryID_Order_IsActive",
                table: "FaqItem",
                columns: new[] { "CategoryID", "Order", "IsActive" });

            migrationBuilder.CreateIndex(
                name: "IX_FaqItem_IsActive",
                table: "FaqItem",
                column: "IsActive");

            migrationBuilder.CreateIndex(
                name: "IX_FaqItem_Order",
                table: "FaqItem",
                column: "Order");

            migrationBuilder.CreateIndex(
                name: "IX_FaqItem_Order_IsActive",
                table: "FaqItem",
                columns: new[] { "Order", "IsActive" });

            migrationBuilder.CreateIndex(
                name: "IX_Member_CreatedAt",
                table: "Member",
                column: "CreatedAt");

            migrationBuilder.CreateIndex(
                name: "IX_Member_DeletedAt",
                table: "Member",
                column: "DeletedAt");

            migrationBuilder.CreateIndex(
                name: "IX_Member_Email",
                table: "Member",
                column: "Email",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Member_FullName",
                table: "Member",
                column: "FullName");

            migrationBuilder.CreateIndex(
                name: "IX_Member_Gender",
                table: "Member",
                column: "Gender");

            migrationBuilder.CreateIndex(
                name: "IX_Member_IsAdmin",
                table: "Member",
                column: "IsAdmin");

            migrationBuilder.CreateIndex(
                name: "IX_Member_IsAuthCertified",
                table: "Member",
                column: "IsAuthCertified");

            migrationBuilder.CreateIndex(
                name: "IX_Member_IsCreator",
                table: "Member",
                column: "IsCreator");

            migrationBuilder.CreateIndex(
                name: "IX_Member_IsDenied",
                table: "Member",
                column: "IsDenied");

            migrationBuilder.CreateIndex(
                name: "IX_Member_IsEmailVerified",
                table: "Member",
                column: "IsEmailVerified");

            migrationBuilder.CreateIndex(
                name: "IX_Member_IsWithdraw",
                table: "Member",
                column: "IsWithdraw");

            migrationBuilder.CreateIndex(
                name: "IX_Member_MemberGradeID",
                table: "Member",
                column: "MemberGradeID");

            migrationBuilder.CreateIndex(
                name: "IX_Member_Name",
                table: "Member",
                column: "Name",
                unique: true,
                filter: "[Name] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_Member_Phone",
                table: "Member",
                column: "Phone");

            migrationBuilder.CreateIndex(
                name: "IX_Member_SID",
                table: "Member",
                column: "SID",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_MemberEmailChangeLog_CreatedAt",
                table: "MemberEmailChangeLog",
                column: "CreatedAt");

            migrationBuilder.CreateIndex(
                name: "IX_MemberEmailChangeLog_MemberID",
                table: "MemberEmailChangeLog",
                column: "MemberID");

            migrationBuilder.CreateIndex(
                name: "IX_MemberGrade_EngName",
                table: "MemberGrade",
                column: "EngName",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_MemberGrade_IsActive",
                table: "MemberGrade",
                column: "IsActive");

            migrationBuilder.CreateIndex(
                name: "IX_MemberGrade_KorName",
                table: "MemberGrade",
                column: "KorName",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_MemberGrade_Order",
                table: "MemberGrade",
                column: "Order");

            migrationBuilder.CreateIndex(
                name: "IX_MemberGrade_Order_IsActive",
                table: "MemberGrade",
                columns: new[] { "Order", "IsActive" });

            migrationBuilder.CreateIndex(
                name: "IX_MemberIntroChangeLog_MemberID",
                table: "MemberIntroChangeLog",
                column: "MemberID");

            migrationBuilder.CreateIndex(
                name: "IX_MemberLoginLog_Account",
                table: "MemberLoginLog",
                column: "Account");

            migrationBuilder.CreateIndex(
                name: "IX_MemberLoginLog_MemberID",
                table: "MemberLoginLog",
                column: "MemberID");

            migrationBuilder.CreateIndex(
                name: "IX_MemberLoginLog_MemberID_Success",
                table: "MemberLoginLog",
                columns: new[] { "MemberID", "Success" });

            migrationBuilder.CreateIndex(
                name: "IX_MemberNameChangeLog_MemberID",
                table: "MemberNameChangeLog",
                column: "MemberID");

            migrationBuilder.CreateIndex(
                name: "IX_MemberSummaryChangeLog_MemberID",
                table: "MemberSummaryChangeLog",
                column: "MemberID");

            migrationBuilder.CreateIndex(
                name: "IX_Popup_Order",
                table: "Popup",
                column: "Order");

            migrationBuilder.CreateIndex(
                name: "IX_Popup_Order_IsActive",
                table: "Popup",
                columns: new[] { "Order", "IsActive" });

            migrationBuilder.CreateIndex(
                name: "IX_Popup_StartAt_EndAt_Order_IsActive",
                table: "Popup",
                columns: new[] { "StartAt", "EndAt", "Order", "IsActive" });

            migrationBuilder.CreateIndex(
                name: "IX_Wallet_MemberID",
                table: "Wallet",
                column: "MemberID",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Wallet_WalletKey",
                table: "Wallet",
                column: "WalletKey",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_WalletBalance_WalletKey_Type",
                table: "WalletBalance",
                columns: new[] { "WalletKey", "Type" },
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_WalletTransaction_CreatedAt",
                table: "WalletTransaction",
                column: "CreatedAt");

            migrationBuilder.CreateIndex(
                name: "IX_WalletTransaction_WalletKey",
                table: "WalletTransaction",
                column: "WalletKey");

            migrationBuilder.CreateIndex(
                name: "IX_WalletTransaction_WalletKey_CreatedAt",
                table: "WalletTransaction",
                columns: new[] { "WalletKey", "CreatedAt" });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "BannerItem");

            migrationBuilder.DropTable(
                name: "Channel");

            migrationBuilder.DropTable(
                name: "Config");

            migrationBuilder.DropTable(
                name: "Document");

            migrationBuilder.DropTable(
                name: "EmailVerifyNumber");

            migrationBuilder.DropTable(
                name: "EmailVerifyToken");

            migrationBuilder.DropTable(
                name: "FaqItem");

            migrationBuilder.DropTable(
                name: "MemberApprove");

            migrationBuilder.DropTable(
                name: "MemberEmailChangeLog");

            migrationBuilder.DropTable(
                name: "MemberIntroChangeLog");

            migrationBuilder.DropTable(
                name: "MemberLoginLog");

            migrationBuilder.DropTable(
                name: "MemberNameChangeLog");

            migrationBuilder.DropTable(
                name: "MemberStats");

            migrationBuilder.DropTable(
                name: "MemberSummaryChangeLog");

            migrationBuilder.DropTable(
                name: "Popup");

            migrationBuilder.DropTable(
                name: "WalletBalance");

            migrationBuilder.DropTable(
                name: "WalletTransaction");

            migrationBuilder.DropTable(
                name: "BannerPosition");

            migrationBuilder.DropTable(
                name: "FaqCategory");

            migrationBuilder.DropTable(
                name: "Wallet");

            migrationBuilder.DropTable(
                name: "Member");

            migrationBuilder.DropTable(
                name: "MemberGrade");
        }
    }
}
