using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Infrastructure.Migrations.AppDb { /// public partial class RemoveDonationSettlementDeveloperDomains : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ApiApplicationScope"); migrationBuilder.DropTable( name: "ApiCredential"); migrationBuilder.DropTable( name: "ApiPersonalAccessToken"); migrationBuilder.DropTable( name: "ApiPurchaseCancel"); migrationBuilder.DropTable( name: "ApiRateLimit"); migrationBuilder.DropTable( name: "ApiRequestLog"); migrationBuilder.DropTable( name: "CrewDonationSummary"); migrationBuilder.DropTable( name: "CrewInvitation"); migrationBuilder.DropTable( name: "CrewSessionConsent"); migrationBuilder.DropTable( name: "CrewWidgetConfig"); migrationBuilder.DropTable( name: "DonationAlertAttempt"); migrationBuilder.DropTable( name: "DonationAlertConfig"); migrationBuilder.DropTable( name: "DonationGoalConfig"); migrationBuilder.DropTable( name: "DonationMeta"); migrationBuilder.DropTable( name: "DonationRankConfig"); migrationBuilder.DropTable( name: "DonationRanking"); migrationBuilder.DropTable( name: "DonorChannelStats"); migrationBuilder.DropTable( name: "DonorTitleSelection"); migrationBuilder.DropTable( name: "GameProductCatalog"); migrationBuilder.DropTable( name: "NiceAuthSession"); migrationBuilder.DropTable( name: "RankingSnapshot"); migrationBuilder.DropTable( name: "Settlement"); migrationBuilder.DropTable( name: "SettlementAccount"); migrationBuilder.DropTable( name: "WithdrawalRequest"); migrationBuilder.DropTable( name: "ApiPurchase"); migrationBuilder.DropTable( name: "DonationAlert"); migrationBuilder.DropTable( name: "ChannelTitle"); migrationBuilder.DropTable( name: "Developer"); migrationBuilder.DropTable( name: "ApiApplication"); migrationBuilder.DropTable( name: "Donation"); migrationBuilder.DropTable( name: "CrewMember"); migrationBuilder.DropTable( name: "CrewSession"); migrationBuilder.DropTable( name: "Crew"); migrationBuilder.DropColumn( name: "ApiCommissionRate", table: "Game"); migrationBuilder.AlterColumn( name: "ChannelRewardAmount", table: "Order", type: "int", nullable: false, comment: "채널주 채널 보상 입금 금액 (비활성 — 과거 주문 호환)", oldClrType: typeof(int), oldType: "int", oldComment: "채널주 StoreRevenue 입금 금액"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn( name: "ChannelRewardAmount", table: "Order", type: "int", nullable: false, comment: "채널주 StoreRevenue 입금 금액", oldClrType: typeof(int), oldType: "int", oldComment: "채널주 채널 보상 입금 금액 (비활성 — 과거 주문 호환)"); migrationBuilder.AddColumn( name: "ApiCommissionRate", table: "Game", type: "decimal(10,7)", precision: 10, scale: 7, nullable: false, defaultValue: 0m, comment: "API 결제 보고 채널 수수료율(%) — 0~100, 0=비대상"); migrationBuilder.CreateTable( name: "ApiApplication", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), OwnerMemberID = table.Column(type: "int", nullable: false), ApprovedAt = table.Column(type: "datetime2", nullable: true), CreatedAt = table.Column(type: "datetime2", nullable: false), Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), HomepageUrl = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), LogoPath = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), Status = table.Column(type: "int", nullable: false), SuspendedAt = table.Column(type: "datetime2", nullable: true), UpdatedAt = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_ApiApplication", x => x.ID); table.ForeignKey( name: "FK_ApiApplication_Member_OwnerMemberID", column: x => x.OwnerMemberID, principalTable: "Member", principalColumn: "ID", onDelete: ReferentialAction.Cascade); }, comment: "개발자 API 앱"); migrationBuilder.CreateTable( name: "ApiPersonalAccessToken", columns: table => new { ID = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), OwnerMemberID = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), ExpiresAt = table.Column(type: "datetime2", nullable: true), LastUsedAt = table.Column(type: "datetime2", nullable: true), Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), RevokedAt = table.Column(type: "datetime2", nullable: true), ScopesCsv = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: false), TokenHash = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), TokenHint = table.Column(type: "nvarchar(4)", maxLength: 4, nullable: false) }, constraints: table => { table.PrimaryKey("PK_ApiPersonalAccessToken", x => x.ID); table.ForeignKey( name: "FK_ApiPersonalAccessToken_Member_OwnerMemberID", column: x => x.OwnerMemberID, principalTable: "Member", principalColumn: "ID", onDelete: ReferentialAction.Cascade); }, comment: "Personal Access Token (PAT)"); migrationBuilder.CreateTable( name: "ApiRequestLog", columns: table => new { ID = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ApplicationID = table.Column(type: "int", nullable: true), Endpoint = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), IpAddress = table.Column(type: "nvarchar(45)", maxLength: 45, nullable: true), Method = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: false), PatID = table.Column(type: "bigint", nullable: true), RequestedAt = table.Column(type: "datetime2", nullable: false), ResponseMs = table.Column(type: "int", nullable: false), StatusCode = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ApiRequestLog", x => x.ID); }, comment: "공개 API 호출 로그"); migrationBuilder.CreateTable( name: "ChannelTitle", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ChannelID = table.Column(type: "int", nullable: false, comment: "채널 ID"), Color = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false, comment: "칭호 색상 (hex)"), CreatedAt = table.Column(type: "datetime2", nullable: false, comment: "생성 일시"), Description = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "칭호 설명"), IconUrl = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true, comment: "칭호 아이콘 URL"), IsActive = table.Column(type: "bit", nullable: false, comment: "활성 여부"), MinAmount = table.Column(type: "bigint", nullable: false, comment: "획득 조건 (누적 후원 최소 금액)"), Name = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false, comment: "칭호 이름"), SortOrder = table.Column(type: "int", nullable: false, comment: "정렬 순서"), UpdatedAt = table.Column(type: "datetime2", nullable: true, comment: "수정 일시") }, constraints: table => { table.PrimaryKey("PK_ChannelTitle", x => x.ID); table.ForeignKey( name: "FK_ChannelTitle_Channel_ChannelID", column: x => x.ChannelID, principalTable: "Channel", principalColumn: "ID", onDelete: ReferentialAction.Cascade); }, comment: "채널별 칭호 (크리에이터 설정)"); migrationBuilder.CreateTable( name: "Crew", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ChannelID = table.Column(type: "int", nullable: false), MemberID = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), InviteCode = table.Column(type: "nvarchar(8)", maxLength: 8, nullable: true), IsActive = table.Column(type: "bit", nullable: false), MinAmount = table.Column(type: "int", nullable: true), Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), UpdatedAt = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Crew", x => x.ID); table.ForeignKey( name: "FK_Crew_Channel_ChannelID", column: x => x.ChannelID, principalTable: "Channel", principalColumn: "ID", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Crew_Member_MemberID", column: x => x.MemberID, principalTable: "Member", principalColumn: "ID"); }, comment: "크루"); migrationBuilder.CreateTable( name: "Developer", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), MemberID = table.Column(type: "int", nullable: false), ApprovalReason = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), ApprovalStatus = table.Column(type: "int", nullable: false), ApprovedAt = table.Column(type: "datetime2", nullable: true), ApprovedByAdminID = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true), BusinessNumber = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), CeoName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), CompanyName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), ContactName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), ContactPhone = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), KycCi = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), KycDi = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), KycStatus = table.Column(type: "int", nullable: false), KycVerifiedAt = table.Column(type: "datetime2", nullable: true), UpdatedAt = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Developer", x => x.ID); table.ForeignKey( name: "FK_Developer_Member_MemberID", column: x => x.MemberID, principalTable: "Member", principalColumn: "ID", onDelete: ReferentialAction.Cascade); }, comment: "개발자 포털 가입 법인 정보 (Member 1:1)"); migrationBuilder.CreateTable( name: "DonationAlertConfig", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ChannelID = table.Column(type: "int", nullable: false), MemberID = table.Column(type: "int", nullable: false), Amount = table.Column(type: "int", nullable: false), AmountFontColor = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), AmountFontFamily = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), AmountFontSize = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), DisplayDurationSec = table.Column(type: "float", nullable: false), EnableImage = table.Column(type: "bit", nullable: false), EnableSound = table.Column(type: "bit", nullable: false), ImageUrl = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), IsActive = table.Column(type: "bit", nullable: false), MatchType = table.Column(type: "int", nullable: false), Message = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), MessageFontColor = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), MessageFontFamily = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), MessageFontSize = table.Column(type: "int", nullable: false), NicknameFontColor = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), NicknameFontFamily = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), NicknameFontSize = table.Column(type: "int", nullable: false), PlayDelaySec = table.Column(type: "float", nullable: false), PopupEffect = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), SoundUrl = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), TemplateFontColor = table.Column(type: "nvarchar(max)", nullable: false), TemplateFontFamily = table.Column(type: "nvarchar(max)", nullable: true), TemplateFontSize = table.Column(type: "int", nullable: false), TextEffect = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), Title = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), UpdatedAt = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_DonationAlertConfig", x => x.ID); table.ForeignKey( name: "FK_DonationAlertConfig_Channel_ChannelID", column: x => x.ChannelID, principalTable: "Channel", principalColumn: "ID", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_DonationAlertConfig_Member_MemberID", column: x => x.MemberID, principalTable: "Member", principalColumn: "ID"); }, comment: "후원 알림 위젯 설정"); migrationBuilder.CreateTable( name: "DonationGoalConfig", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ChannelID = table.Column(type: "int", nullable: false), MemberID = table.Column(type: "int", nullable: false), AmountFontColor = table.Column(type: "nvarchar(9)", maxLength: 9, nullable: false), AmountFontFamily = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), AmountFontSizePx = table.Column(type: "int", nullable: false), BarBackgroundColor = table.Column(type: "nvarchar(9)", maxLength: 9, nullable: false), BarColor = table.Column(type: "nvarchar(9)", maxLength: 9, nullable: false), BarHeightPx = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), EndAt = table.Column(type: "datetime2", nullable: true), IsActive = table.Column(type: "bit", nullable: false), IsShowPercent = table.Column(type: "bit", nullable: false), Period = table.Column(type: "int", nullable: false, defaultValue: 6), StartAmount = table.Column(type: "int", nullable: false), StartAt = table.Column(type: "datetime2", nullable: true), Style = table.Column(type: "int", nullable: false), TargetAmount = table.Column(type: "int", nullable: false), Title = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), TitleFontColor = table.Column(type: "nvarchar(9)", maxLength: 9, nullable: false), TitleFontFamily = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), TitleFontSizePx = table.Column(type: "int", nullable: false), UpdatedAt = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_DonationGoalConfig", x => x.ID); table.ForeignKey( name: "FK_DonationGoalConfig_Channel_ChannelID", column: x => x.ChannelID, principalTable: "Channel", principalColumn: "ID", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_DonationGoalConfig_Member_MemberID", column: x => x.MemberID, principalTable: "Member", principalColumn: "ID"); }, comment: "후원 목표 위젯 설정"); migrationBuilder.CreateTable( name: "DonationMeta", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ChannelID = table.Column(type: "int", nullable: false), MemberID = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), IsAccepting = table.Column(type: "bit", nullable: false), IsAudioOnly = table.Column(type: "bit", nullable: false), IsPaused = table.Column(type: "bit", nullable: false), IsVideoOnly = table.Column(type: "bit", nullable: false), MinAmount = table.Column(type: "int", nullable: false), UpdatedAt = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_DonationMeta", x => x.ID); table.ForeignKey( name: "FK_DonationMeta_Channel_ChannelID", column: x => x.ChannelID, principalTable: "Channel", principalColumn: "ID", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_DonationMeta_Member_MemberID", column: x => x.MemberID, principalTable: "Member", principalColumn: "ID"); }, comment: "후원 공통 설정"); migrationBuilder.CreateTable( name: "DonationRankConfig", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ChannelID = table.Column(type: "int", nullable: false), MemberID = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), EndAt = table.Column(type: "datetime2", nullable: true), IsActive = table.Column(type: "bit", nullable: false), IsShowAmount = table.Column(type: "bit", nullable: false), IsShowDonationCount = table.Column(type: "bit", nullable: false), IsShowGradeIcon = table.Column(type: "bit", nullable: false), IsShowMemberIcon = table.Column(type: "bit", nullable: false), MaxRankCount = table.Column(type: "int", nullable: false), NameDisplayType = table.Column(type: "int", nullable: false), NameMode = table.Column(type: "bit", nullable: true), Period = table.Column(type: "int", nullable: false), Rank1FontColor = table.Column(type: "nvarchar(max)", nullable: false), Rank1FontFamily = table.Column(type: "nvarchar(max)", nullable: true), Rank1FontSizePx = table.Column(type: "int", nullable: false), Rank2FontColor = table.Column(type: "nvarchar(max)", nullable: false), Rank2FontFamily = table.Column(type: "nvarchar(max)", nullable: true), Rank2FontSizePx = table.Column(type: "int", nullable: false), Rank3FontColor = table.Column(type: "nvarchar(max)", nullable: false), Rank3FontFamily = table.Column(type: "nvarchar(max)", nullable: true), Rank3FontSizePx = table.Column(type: "int", nullable: false), StartAt = table.Column(type: "datetime2", nullable: true), Theme = table.Column(type: "int", nullable: false), Title = table.Column(type: "nvarchar(300)", maxLength: 300, nullable: false), TitleFontColor = table.Column(type: "nvarchar(max)", nullable: false), TitleFontFamily = table.Column(type: "nvarchar(max)", nullable: true), TitleFontSizePx = table.Column(type: "int", nullable: false), UpdatedAt = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_DonationRankConfig", x => x.ID); table.ForeignKey( name: "FK_DonationRankConfig_Channel_ChannelID", column: x => x.ChannelID, principalTable: "Channel", principalColumn: "ID", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_DonationRankConfig_Member_MemberID", column: x => x.MemberID, principalTable: "Member", principalColumn: "ID"); }, comment: "후원 순위 위젯 설정"); migrationBuilder.CreateTable( name: "DonationRanking", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ChannelID = table.Column(type: "int", nullable: false), SponsorMemberID = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), DonationCount = table.Column(type: "int", nullable: false), IsActive = table.Column(type: "bit", nullable: false), PeriodEnd = table.Column(type: "datetime2", nullable: true), PeriodStart = table.Column(type: "datetime2", nullable: false), PeriodType = table.Column(type: "int", nullable: false), Rank = table.Column(type: "int", nullable: false), SponsorName = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), TotalAmount = table.Column(type: "int", nullable: false), UpdatedAt = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_DonationRanking", x => x.ID); table.ForeignKey( name: "FK_DonationRanking_Channel_ChannelID", column: x => x.ChannelID, principalTable: "Channel", principalColumn: "ID", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_DonationRanking_Member_SponsorMemberID", column: x => x.SponsorMemberID, principalTable: "Member", principalColumn: "ID"); }, comment: "후원 순위"); migrationBuilder.CreateTable( name: "DonorChannelStats", columns: table => new { DonorMemberID = table.Column(type: "int", nullable: false, comment: "후원자 회원 ID"), ChannelID = table.Column(type: "int", nullable: false, comment: "채널 ID"), CreatedAt = table.Column(type: "datetime2", nullable: false, comment: "생성 일시"), CumulativeAmount = table.Column(type: "bigint", nullable: false, comment: "누적 후원 금액"), DonationCount = table.Column(type: "int", nullable: false, comment: "후원 횟수"), FirstDonatedAt = table.Column(type: "datetime2", nullable: true, comment: "첫 후원 일시"), LastDonatedAt = table.Column(type: "datetime2", nullable: true, comment: "마지막 후원 일시"), UpdatedAt = table.Column(type: "datetime2", nullable: true, comment: "수정 일시") }, constraints: table => { table.PrimaryKey("PK_DonorChannelStats", x => new { x.DonorMemberID, x.ChannelID }); table.ForeignKey( name: "FK_DonorChannelStats_Channel_ChannelID", column: x => x.ChannelID, principalTable: "Channel", principalColumn: "ID"); table.ForeignKey( name: "FK_DonorChannelStats_Member_DonorMemberID", column: x => x.DonorMemberID, principalTable: "Member", principalColumn: "ID"); }, comment: "후원자×채널 누적 후원 (칭호 획득 판정용)"); migrationBuilder.CreateTable( name: "GameProductCatalog", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), GameID = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), IsActive = table.Column(type: "bit", nullable: false), Price = table.Column(type: "int", nullable: false), ProductID = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), UpdatedAt = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_GameProductCatalog", x => x.ID); table.ForeignKey( name: "FK_GameProductCatalog_Game_GameID", column: x => x.GameID, principalTable: "Game", principalColumn: "ID", onDelete: ReferentialAction.Cascade); }, comment: "게임별 인앱 상품 SKU 정가 카탈로그 (API 결제 보고가 검증용)"); migrationBuilder.CreateTable( name: "RankingSnapshot", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), MemberID = table.Column(type: "int", nullable: false, comment: "회원 ID"), BroadcastSec = table.Column(type: "bigint", nullable: false, comment: "방송 시간 (초)"), Category = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: true, comment: "카테고리 (전체/게임/버츄얼/토크/음악/먹방)"), DonorCount = table.Column(type: "int", nullable: false, comment: "후원자 수"), LikeCount = table.Column(type: "bigint", nullable: false, comment: "좋아요"), MoneyAmount = table.Column(type: "bigint", nullable: false, comment: "수령/후원 금액"), Period = table.Column(type: "int", nullable: false, comment: "기간 (1=오늘, 2=어제, 3=이번주, 4=이번달, 5=지난달, 6=전체)"), PeriodEnd = table.Column(type: "datetime2", nullable: false, comment: "기간 종료"), PeriodStart = table.Column(type: "datetime2", nullable: false, comment: "기간 시작"), PreviousRank = table.Column(type: "int", nullable: true, comment: "전일 순위"), Rank = table.Column(type: "int", nullable: false, comment: "순위"), Score = table.Column(type: "bigint", nullable: false, comment: "종합 점수"), SnapshotAt = table.Column(type: "datetime2", nullable: false, comment: "스냅샷 일시"), Type = table.Column(type: "int", nullable: false, comment: "랭킹 종류 (1=종합, 2=크리에이터, 3=후원자)"), ViewCount = table.Column(type: "bigint", nullable: false, comment: "조회수") }, constraints: table => { table.PrimaryKey("PK_RankingSnapshot", x => x.ID); table.ForeignKey( name: "FK_RankingSnapshot_Member_MemberID", column: x => x.MemberID, principalTable: "Member", principalColumn: "ID"); }, comment: "랭킹 스냅샷 (일 1회 집계)"); migrationBuilder.CreateTable( name: "Settlement", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ChannelID = table.Column(type: "int", nullable: false), MemberID = table.Column(type: "int", nullable: false), AdminMemo = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), ApprovedAt = table.Column(type: "datetime2", nullable: true), FeeAmount = table.Column(type: "int", nullable: false), GrossAmount = table.Column(type: "int", nullable: false), NetAmount = table.Column(type: "int", nullable: false), PaidAt = table.Column(type: "datetime2", nullable: true), PeriodEnd = table.Column(type: "datetime2", nullable: false), PeriodStart = table.Column(type: "datetime2", nullable: false), RequestedAt = table.Column(type: "datetime2", nullable: false), Status = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Settlement", x => x.ID); table.ForeignKey( name: "FK_Settlement_Channel_ChannelID", column: x => x.ChannelID, principalTable: "Channel", principalColumn: "ID"); table.ForeignKey( name: "FK_Settlement_Member_MemberID", column: x => x.MemberID, principalTable: "Member", principalColumn: "ID"); }, comment: "정산"); migrationBuilder.CreateTable( name: "SettlementAccount", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ChannelID = table.Column(type: "int", nullable: false), MemberID = table.Column(type: "int", nullable: false), AccountHolder = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), AccountNumber = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false), BankCode = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: false), BankName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), IsVerified = table.Column(type: "bit", nullable: false), UpdatedAt = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SettlementAccount", x => x.ID); table.ForeignKey( name: "FK_SettlementAccount_Channel_ChannelID", column: x => x.ChannelID, principalTable: "Channel", principalColumn: "ID"); table.ForeignKey( name: "FK_SettlementAccount_Member_MemberID", column: x => x.MemberID, principalTable: "Member", principalColumn: "ID"); }, comment: "정산 계좌"); migrationBuilder.CreateTable( name: "WithdrawalRequest", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ChannelID = table.Column(type: "int", nullable: false), MemberID = table.Column(type: "int", nullable: false), AccountHolder = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), AccountNumber = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false), AdminMemo = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), BankCode = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: false), BankName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), DonationAmount = table.Column(type: "int", nullable: false, defaultValue: 0, comment: "후원 수익(Donation) 잔액에서 차감되는 금액"), IncomeTax = table.Column(type: "int", nullable: false), LocalTax = table.Column(type: "int", nullable: false), NetAmount = table.Column(type: "int", nullable: false), ProcessedAt = table.Column(type: "datetime2", nullable: true), RejectedReason = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), RequestedAmount = table.Column(type: "int", nullable: false), RequestedAt = table.Column(type: "datetime2", nullable: false), Status = table.Column(type: "int", nullable: false), StoreRevenueAmount = table.Column(type: "int", nullable: false, defaultValue: 0, comment: "상품 판매 수익(StoreRevenue) 잔액에서 차감되는 금액"), WithholdingTax = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_WithdrawalRequest", x => x.ID); table.ForeignKey( name: "FK_WithdrawalRequest_Channel_ChannelID", column: x => x.ChannelID, principalTable: "Channel", principalColumn: "ID"); table.ForeignKey( name: "FK_WithdrawalRequest_Member_MemberID", column: x => x.MemberID, principalTable: "Member", principalColumn: "ID"); }, comment: "출금 요청"); migrationBuilder.CreateTable( name: "ApiApplicationScope", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ApplicationID = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), Scope = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false) }, constraints: table => { table.PrimaryKey("PK_ApiApplicationScope", x => x.ID); table.ForeignKey( name: "FK_ApiApplicationScope_ApiApplication_ApplicationID", column: x => x.ApplicationID, principalTable: "ApiApplication", principalColumn: "ID", onDelete: ReferentialAction.Cascade); }, comment: "앱이 요청한 scope 목록"); migrationBuilder.CreateTable( name: "ApiCredential", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ApplicationID = table.Column(type: "int", nullable: false), ClientID = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), LastUsedAt = table.Column(type: "datetime2", nullable: true), RevokedAt = table.Column(type: "datetime2", nullable: true), SecretHash = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), SecretHint = table.Column(type: "nvarchar(4)", maxLength: 4, nullable: false), Status = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ApiCredential", x => x.ID); table.ForeignKey( name: "FK_ApiCredential_ApiApplication_ApplicationID", column: x => x.ApplicationID, principalTable: "ApiApplication", principalColumn: "ID", onDelete: ReferentialAction.Cascade); }, comment: "OAuth2 Client Credentials"); migrationBuilder.CreateTable( name: "ApiPurchase", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ApplicationID = table.Column(type: "int", nullable: false), ChannelID = table.Column(type: "int", nullable: false), GameID = table.Column(type: "int", nullable: false), CanceledAt = table.Column(type: "datetime2", nullable: true), CatalogPrice = table.Column(type: "int", nullable: true), CommissionAmount = table.Column(type: "int", nullable: false), CommissionRate = table.Column(type: "decimal(10,7)", precision: 10, scale: 7, nullable: false), ConfirmDueAt = table.Column(type: "datetime2", nullable: false), ConfirmedAt = table.Column(type: "datetime2", nullable: true), CreatedAt = table.Column(type: "datetime2", nullable: false), CreditedMemberID = table.Column(type: "int", nullable: false), Marketplace = table.Column(type: "int", nullable: false), OrderID = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: false), OrderPrice = table.Column(type: "int", nullable: false), PriceMismatched = table.Column(type: "bit", nullable: false), ProductID = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), Status = table.Column(type: "int", nullable: false), SubID = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true) }, constraints: table => { table.PrimaryKey("PK_ApiPurchase", x => x.ID); table.ForeignKey( name: "FK_ApiPurchase_ApiApplication_ApplicationID", column: x => x.ApplicationID, principalTable: "ApiApplication", principalColumn: "ID", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_ApiPurchase_Channel_ChannelID", column: x => x.ChannelID, principalTable: "Channel", principalColumn: "ID", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_ApiPurchase_Game_GameID", column: x => x.GameID, principalTable: "Game", principalColumn: "ID", onDelete: ReferentialAction.Restrict); }, comment: "게임사 API 결제 보고 원장 (채널 판매 수수료, 14일 보류 후 확정)"); migrationBuilder.CreateTable( name: "ApiRateLimit", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ApplicationID = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), LimitPerMinute = table.Column(type: "int", nullable: false), UpdatedAt = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ApiRateLimit", x => x.ID); table.ForeignKey( name: "FK_ApiRateLimit_ApiApplication_ApplicationID", column: x => x.ApplicationID, principalTable: "ApiApplication", principalColumn: "ID", onDelete: ReferentialAction.Cascade); }, comment: "앱별 Rate Limit override"); migrationBuilder.CreateTable( name: "DonorTitleSelection", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ChannelID = table.Column(type: "int", nullable: false, comment: "채널 ID"), DonorMemberID = table.Column(type: "int", nullable: false, comment: "후원자 회원 ID"), SelectedTitleID = table.Column(type: "int", nullable: true, comment: "선택 칭호 ID"), CreatedAt = table.Column(type: "datetime2", nullable: false, comment: "생성 일시"), UpdatedAt = table.Column(type: "datetime2", nullable: true, comment: "수정 일시") }, constraints: table => { table.PrimaryKey("PK_DonorTitleSelection", x => x.ID); table.ForeignKey( name: "FK_DonorTitleSelection_ChannelTitle_SelectedTitleID", column: x => x.SelectedTitleID, principalTable: "ChannelTitle", principalColumn: "ID", onDelete: ReferentialAction.SetNull); table.ForeignKey( name: "FK_DonorTitleSelection_Channel_ChannelID", column: x => x.ChannelID, principalTable: "Channel", principalColumn: "ID"); table.ForeignKey( name: "FK_DonorTitleSelection_Member_DonorMemberID", column: x => x.DonorMemberID, principalTable: "Member", principalColumn: "ID"); }, comment: "후원자가 선택한 채널별 대표 칭호"); migrationBuilder.CreateTable( name: "CrewInvitation", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), CrewID = table.Column(type: "int", nullable: false), InvitedByMemberID = table.Column(type: "int", nullable: false), TargetMemberID = table.Column(type: "int", nullable: false), ExpiresAt = table.Column(type: "datetime2", nullable: false), InvitedAt = table.Column(type: "datetime2", nullable: false), Nickname = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), RespondedAt = table.Column(type: "datetime2", nullable: true), Role = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), SortOrder = table.Column(type: "int", nullable: false), Status = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_CrewInvitation", x => x.ID); table.ForeignKey( name: "FK_CrewInvitation_Crew_CrewID", column: x => x.CrewID, principalTable: "Crew", principalColumn: "ID", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_CrewInvitation_Member_InvitedByMemberID", column: x => x.InvitedByMemberID, principalTable: "Member", principalColumn: "ID"); table.ForeignKey( name: "FK_CrewInvitation_Member_TargetMemberID", column: x => x.TargetMemberID, principalTable: "Member", principalColumn: "ID"); }, comment: "크루원 초대 이력"); migrationBuilder.CreateTable( name: "CrewMember", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ChannelID = table.Column(type: "int", nullable: true), CrewID = table.Column(type: "int", nullable: false), MemberID = table.Column(type: "int", nullable: false), IsActive = table.Column(type: "bit", nullable: false), JoinedAt = table.Column(type: "datetime2", nullable: false), Nickname = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), Role = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), SortOrder = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_CrewMember", x => x.ID); table.ForeignKey( name: "FK_CrewMember_Channel_ChannelID", column: x => x.ChannelID, principalTable: "Channel", principalColumn: "ID"); table.ForeignKey( name: "FK_CrewMember_Crew_CrewID", column: x => x.CrewID, principalTable: "Crew", principalColumn: "ID", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_CrewMember_Member_MemberID", column: x => x.MemberID, principalTable: "Member", principalColumn: "ID"); }, comment: "크루원"); migrationBuilder.CreateTable( name: "CrewSession", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), CrewID = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), EndedAt = table.Column(type: "datetime2", nullable: true), StartedAt = table.Column(type: "datetime2", nullable: true), Status = table.Column(type: "int", nullable: false), Title = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), TotalAmount = table.Column(type: "int", nullable: false), TotalDonationCount = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_CrewSession", x => x.ID); table.ForeignKey( name: "FK_CrewSession_Crew_CrewID", column: x => x.CrewID, principalTable: "Crew", principalColumn: "ID", onDelete: ReferentialAction.Cascade); }, comment: "크루 후원 방송 세션"); migrationBuilder.CreateTable( name: "CrewWidgetConfig", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ChannelID = table.Column(type: "int", nullable: false), CrewID = table.Column(type: "int", nullable: false), MemberID = table.Column(type: "int", nullable: false), BgColor = table.Column(type: "nvarchar(7)", maxLength: 7, nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), EndAt = table.Column(type: "datetime2", nullable: true), IsActive = table.Column(type: "bit", nullable: false), IsShowAmount = table.Column(type: "bit", nullable: false), IsShowContributionRate = table.Column(type: "bit", nullable: false), IsShowDonationCount = table.Column(type: "bit", nullable: false), IsShowMemberIcon = table.Column(type: "bit", nullable: false), MaxDisplayCount = table.Column(type: "int", nullable: false), Period = table.Column(type: "int", nullable: false), Rank1FontColor = table.Column(type: "nvarchar(7)", maxLength: 7, nullable: false), Rank1FontFamily = table.Column(type: "nvarchar(max)", nullable: true), Rank1FontSizePx = table.Column(type: "int", nullable: false), Rank2FontColor = table.Column(type: "nvarchar(7)", maxLength: 7, nullable: false), Rank2FontFamily = table.Column(type: "nvarchar(max)", nullable: true), Rank2FontSizePx = table.Column(type: "int", nullable: false), Rank3FontColor = table.Column(type: "nvarchar(7)", maxLength: 7, nullable: false), Rank3FontFamily = table.Column(type: "nvarchar(max)", nullable: true), Rank3FontSizePx = table.Column(type: "int", nullable: false), RowFontColor = table.Column(type: "nvarchar(7)", maxLength: 7, nullable: false), RowFontFamily = table.Column(type: "nvarchar(max)", nullable: true), RowFontSizePx = table.Column(type: "int", nullable: false), StartAt = table.Column(type: "datetime2", nullable: true), Theme = table.Column(type: "int", nullable: false), Title = table.Column(type: "nvarchar(300)", maxLength: 300, nullable: false), TitleFontColor = table.Column(type: "nvarchar(7)", maxLength: 7, nullable: false), TitleFontFamily = table.Column(type: "nvarchar(max)", nullable: true), TitleFontSizePx = table.Column(type: "int", nullable: false), UpdatedAt = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_CrewWidgetConfig", x => x.ID); table.ForeignKey( name: "FK_CrewWidgetConfig_Channel_ChannelID", column: x => x.ChannelID, principalTable: "Channel", principalColumn: "ID", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_CrewWidgetConfig_Crew_CrewID", column: x => x.CrewID, principalTable: "Crew", principalColumn: "ID"); table.ForeignKey( name: "FK_CrewWidgetConfig_Member_MemberID", column: x => x.MemberID, principalTable: "Member", principalColumn: "ID"); }, comment: "크루 위젯 설정"); migrationBuilder.CreateTable( name: "NiceAuthSession", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), DeveloperID = table.Column(type: "int", nullable: false), CompletedAt = table.Column(type: "datetime2", nullable: true), CreatedAt = table.Column(type: "datetime2", nullable: false), ExpiresAt = table.Column(type: "datetime2", nullable: false), FailReason = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), Iterators = table.Column(type: "int", nullable: false), RequestNo = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), SessionToken = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), Status = table.Column(type: "int", nullable: false), Ticket = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), TransactionID = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), WebTransactionID = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true) }, constraints: table => { table.PrimaryKey("PK_NiceAuthSession", x => x.ID); table.ForeignKey( name: "FK_NiceAuthSession_Developer_DeveloperID", column: x => x.DeveloperID, principalTable: "Developer", principalColumn: "ID", onDelete: ReferentialAction.Cascade); }, comment: "NICE 통합인증 1회 진행 세션"); migrationBuilder.CreateTable( name: "ApiPurchaseCancel", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), PurchaseID = table.Column(type: "int", nullable: false), ApplicationID = table.Column(type: "int", nullable: false), ChannelID = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), CreditedMemberID = table.Column(type: "int", nullable: false), RecoveredAmount = table.Column(type: "int", nullable: false), ShortfallAmount = table.Column(type: "int", nullable: false), WasConfirmed = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ApiPurchaseCancel", x => x.ID); table.ForeignKey( name: "FK_ApiPurchaseCancel_ApiPurchase_PurchaseID", column: x => x.PurchaseID, principalTable: "ApiPurchase", principalColumn: "ID", onDelete: ReferentialAction.Restrict); }, comment: "API 결제 취소 감사 기록 (1 결제 1 취소)"); migrationBuilder.CreateTable( name: "CrewDonationSummary", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), CrewMemberID = table.Column(type: "int", nullable: false), CrewSessionID = table.Column(type: "int", nullable: false), ContributionRate = table.Column(type: "decimal(5,2)", precision: 5, scale: 2, nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), DonationCount = table.Column(type: "int", nullable: false), Rank = table.Column(type: "int", nullable: false), TotalAmount = table.Column(type: "int", nullable: false), UpdatedAt = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_CrewDonationSummary", x => x.ID); table.ForeignKey( name: "FK_CrewDonationSummary_CrewMember_CrewMemberID", column: x => x.CrewMemberID, principalTable: "CrewMember", principalColumn: "ID"); table.ForeignKey( name: "FK_CrewDonationSummary_CrewSession_CrewSessionID", column: x => x.CrewSessionID, principalTable: "CrewSession", principalColumn: "ID", onDelete: ReferentialAction.Cascade); }, comment: "크루원 후원 집계"); migrationBuilder.CreateTable( name: "CrewSessionConsent", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), CrewMemberID = table.Column(type: "int", nullable: false), CrewSessionID = table.Column(type: "int", nullable: false), ConsentedAt = table.Column(type: "datetime2", nullable: true), CreatedAt = table.Column(type: "datetime2", nullable: false), IsConsented = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_CrewSessionConsent", x => x.ID); table.ForeignKey( name: "FK_CrewSessionConsent_CrewMember_CrewMemberID", column: x => x.CrewMemberID, principalTable: "CrewMember", principalColumn: "ID"); table.ForeignKey( name: "FK_CrewSessionConsent_CrewSession_CrewSessionID", column: x => x.CrewSessionID, principalTable: "CrewSession", principalColumn: "ID", onDelete: ReferentialAction.Cascade); }, comment: "크루원 방송 동의"); migrationBuilder.CreateTable( name: "Donation", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ChannelID = table.Column(type: "int", nullable: false), CrewMemberID = table.Column(type: "int", nullable: true), CrewSessionID = table.Column(type: "int", nullable: true), ReceiverMemberID = table.Column(type: "int", nullable: false), SponsorMemberID = table.Column(type: "int", nullable: false), Amount = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), FeeAmount = table.Column(type: "int", nullable: false), FeeRate = table.Column(type: "decimal(5,2)", precision: 5, scale: 2, nullable: false), IsTest = table.Column(type: "bit", nullable: false), Message = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), NetAmount = table.Column(type: "int", nullable: false), SendName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) }, constraints: table => { table.PrimaryKey("PK_Donation", x => x.ID); table.ForeignKey( name: "FK_Donation_Channel_ChannelID", column: x => x.ChannelID, principalTable: "Channel", principalColumn: "ID"); table.ForeignKey( name: "FK_Donation_CrewMember_CrewMemberID", column: x => x.CrewMemberID, principalTable: "CrewMember", principalColumn: "ID"); table.ForeignKey( name: "FK_Donation_CrewSession_CrewSessionID", column: x => x.CrewSessionID, principalTable: "CrewSession", principalColumn: "ID"); table.ForeignKey( name: "FK_Donation_Member_ReceiverMemberID", column: x => x.ReceiverMemberID, principalTable: "Member", principalColumn: "ID"); table.ForeignKey( name: "FK_Donation_Member_SponsorMemberID", column: x => x.SponsorMemberID, principalTable: "Member", principalColumn: "ID"); }, comment: "후원 내역"); migrationBuilder.CreateTable( name: "DonationAlert", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), DonationID = table.Column(type: "int", nullable: false), ReceiverMemberID = table.Column(type: "int", nullable: false), SponsorMemberID = table.Column(type: "int", nullable: false), ArrivedAt = table.Column(type: "datetime2", nullable: true), CorrelationID = table.Column(type: "uniqueidentifier", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), IpAddress = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), StartAt = table.Column(type: "datetime2", nullable: false), Status = table.Column(type: "int", nullable: false), TotalDelayMs = table.Column(type: "float", nullable: true), UserAgent = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true) }, constraints: table => { table.PrimaryKey("PK_DonationAlert", x => x.ID); table.ForeignKey( name: "FK_DonationAlert_Donation_DonationID", column: x => x.DonationID, principalTable: "Donation", principalColumn: "ID", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_DonationAlert_Member_ReceiverMemberID", column: x => x.ReceiverMemberID, principalTable: "Member", principalColumn: "ID"); table.ForeignKey( name: "FK_DonationAlert_Member_SponsorMemberID", column: x => x.SponsorMemberID, principalTable: "Member", principalColumn: "ID"); }, comment: "후원 알림 추적"); migrationBuilder.CreateTable( name: "DonationAlertAttempt", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), DonationAlertID = table.Column(type: "int", nullable: false), DonationID = table.Column(type: "int", nullable: false), IpAddress = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), SentAt = table.Column(type: "datetime2", nullable: false), UserAgent = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: true) }, constraints: table => { table.PrimaryKey("PK_DonationAlertAttempt", x => x.ID); table.ForeignKey( name: "FK_DonationAlertAttempt_DonationAlert_DonationAlertID", column: x => x.DonationAlertID, principalTable: "DonationAlert", principalColumn: "ID", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_DonationAlertAttempt_Donation_DonationID", column: x => x.DonationID, principalTable: "Donation", principalColumn: "ID"); }, comment: "후원 알림 재시도 기록"); migrationBuilder.CreateIndex( name: "IX_ApiApplication_OwnerMemberID", table: "ApiApplication", column: "OwnerMemberID"); migrationBuilder.CreateIndex( name: "IX_ApiApplication_Status", table: "ApiApplication", column: "Status"); migrationBuilder.CreateIndex( name: "IX_ApiApplicationScope_ApplicationID_Scope", table: "ApiApplicationScope", columns: new[] { "ApplicationID", "Scope" }, unique: true); migrationBuilder.CreateIndex( name: "IX_ApiCredential_ApplicationID", table: "ApiCredential", column: "ApplicationID"); migrationBuilder.CreateIndex( name: "IX_ApiCredential_ClientID", table: "ApiCredential", column: "ClientID", unique: true); migrationBuilder.CreateIndex( name: "IX_ApiPersonalAccessToken_OwnerMemberID", table: "ApiPersonalAccessToken", column: "OwnerMemberID"); migrationBuilder.CreateIndex( name: "IX_ApiPersonalAccessToken_TokenHash", table: "ApiPersonalAccessToken", column: "TokenHash", unique: true); migrationBuilder.CreateIndex( name: "IX_ApiPurchase_ApplicationID_Marketplace_OrderID", table: "ApiPurchase", columns: new[] { "ApplicationID", "Marketplace", "OrderID" }, unique: true); migrationBuilder.CreateIndex( name: "IX_ApiPurchase_ChannelID", table: "ApiPurchase", column: "ChannelID"); migrationBuilder.CreateIndex( name: "IX_ApiPurchase_CreatedAt", table: "ApiPurchase", column: "CreatedAt"); migrationBuilder.CreateIndex( name: "IX_ApiPurchase_GameID", table: "ApiPurchase", column: "GameID"); migrationBuilder.CreateIndex( name: "IX_ApiPurchase_Status_ConfirmDueAt", table: "ApiPurchase", columns: new[] { "Status", "ConfirmDueAt" }); migrationBuilder.CreateIndex( name: "IX_ApiPurchaseCancel_ApplicationID", table: "ApiPurchaseCancel", column: "ApplicationID"); migrationBuilder.CreateIndex( name: "IX_ApiPurchaseCancel_ChannelID", table: "ApiPurchaseCancel", column: "ChannelID"); migrationBuilder.CreateIndex( name: "IX_ApiPurchaseCancel_CreatedAt", table: "ApiPurchaseCancel", column: "CreatedAt"); migrationBuilder.CreateIndex( name: "IX_ApiPurchaseCancel_PurchaseID", table: "ApiPurchaseCancel", column: "PurchaseID", unique: true); migrationBuilder.CreateIndex( name: "IX_ApiRateLimit_ApplicationID", table: "ApiRateLimit", column: "ApplicationID", unique: true); migrationBuilder.CreateIndex( name: "IX_ApiRequestLog_ApplicationID", table: "ApiRequestLog", column: "ApplicationID"); migrationBuilder.CreateIndex( name: "IX_ApiRequestLog_PatID", table: "ApiRequestLog", column: "PatID"); migrationBuilder.CreateIndex( name: "IX_ApiRequestLog_RequestedAt", table: "ApiRequestLog", column: "RequestedAt"); migrationBuilder.CreateIndex( name: "IX_ChannelTitle_ChannelID_MinAmount", table: "ChannelTitle", columns: new[] { "ChannelID", "MinAmount" }); migrationBuilder.CreateIndex( name: "IX_ChannelTitle_ChannelID_SortOrder", table: "ChannelTitle", columns: new[] { "ChannelID", "SortOrder" }); migrationBuilder.CreateIndex( name: "IX_Crew_ChannelID_IsActive", table: "Crew", columns: new[] { "ChannelID", "IsActive" }); migrationBuilder.CreateIndex( name: "IX_Crew_InviteCode", table: "Crew", column: "InviteCode", unique: true, filter: "[InviteCode] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_Crew_MemberID", table: "Crew", column: "MemberID"); migrationBuilder.CreateIndex( name: "IX_CrewDonationSummary_CrewMemberID", table: "CrewDonationSummary", column: "CrewMemberID"); migrationBuilder.CreateIndex( name: "IX_CrewDonationSummary_CrewSessionID_CrewMemberID", table: "CrewDonationSummary", columns: new[] { "CrewSessionID", "CrewMemberID" }, unique: true); migrationBuilder.CreateIndex( name: "IX_CrewDonationSummary_CrewSessionID_Rank", table: "CrewDonationSummary", columns: new[] { "CrewSessionID", "Rank" }); migrationBuilder.CreateIndex( name: "IX_CrewInvitation_CrewID_TargetMemberID_Status", table: "CrewInvitation", columns: new[] { "CrewID", "TargetMemberID", "Status" }); migrationBuilder.CreateIndex( name: "IX_CrewInvitation_InvitedByMemberID", table: "CrewInvitation", column: "InvitedByMemberID"); migrationBuilder.CreateIndex( name: "IX_CrewInvitation_Status_ExpiresAt", table: "CrewInvitation", columns: new[] { "Status", "ExpiresAt" }); migrationBuilder.CreateIndex( name: "IX_CrewInvitation_TargetMemberID", table: "CrewInvitation", column: "TargetMemberID"); migrationBuilder.CreateIndex( name: "IX_CrewMember_ChannelID", table: "CrewMember", column: "ChannelID"); migrationBuilder.CreateIndex( name: "IX_CrewMember_CrewID_MemberID", table: "CrewMember", columns: new[] { "CrewID", "MemberID" }, unique: true); migrationBuilder.CreateIndex( name: "IX_CrewMember_MemberID", table: "CrewMember", column: "MemberID"); migrationBuilder.CreateIndex( name: "IX_CrewSession_CrewID_StartedAt", table: "CrewSession", columns: new[] { "CrewID", "StartedAt" }); migrationBuilder.CreateIndex( name: "IX_CrewSession_CrewID_Status", table: "CrewSession", columns: new[] { "CrewID", "Status" }); migrationBuilder.CreateIndex( name: "IX_CrewSessionConsent_CrewMemberID", table: "CrewSessionConsent", column: "CrewMemberID"); migrationBuilder.CreateIndex( name: "IX_CrewSessionConsent_CrewSessionID_CrewMemberID", table: "CrewSessionConsent", columns: new[] { "CrewSessionID", "CrewMemberID" }, unique: true); migrationBuilder.CreateIndex( name: "IX_CrewWidgetConfig_ChannelID", table: "CrewWidgetConfig", column: "ChannelID"); migrationBuilder.CreateIndex( name: "IX_CrewWidgetConfig_CrewID", table: "CrewWidgetConfig", column: "CrewID"); migrationBuilder.CreateIndex( name: "IX_CrewWidgetConfig_MemberID", table: "CrewWidgetConfig", column: "MemberID"); migrationBuilder.CreateIndex( name: "IX_Developer_ApprovalStatus", table: "Developer", column: "ApprovalStatus"); migrationBuilder.CreateIndex( name: "IX_Developer_BusinessNumber", table: "Developer", column: "BusinessNumber"); migrationBuilder.CreateIndex( name: "IX_Developer_MemberID", table: "Developer", column: "MemberID", unique: true); migrationBuilder.CreateIndex( name: "IX_Donation_ChannelID", table: "Donation", column: "ChannelID"); migrationBuilder.CreateIndex( name: "IX_Donation_ChannelID_CreatedAt", table: "Donation", columns: new[] { "ChannelID", "CreatedAt" }); migrationBuilder.CreateIndex( name: "IX_Donation_CrewMemberID", table: "Donation", column: "CrewMemberID"); migrationBuilder.CreateIndex( name: "IX_Donation_CrewSessionID", table: "Donation", column: "CrewSessionID"); migrationBuilder.CreateIndex( name: "IX_Donation_ReceiverMemberID", table: "Donation", column: "ReceiverMemberID"); migrationBuilder.CreateIndex( name: "IX_Donation_SponsorMemberID", table: "Donation", column: "SponsorMemberID"); migrationBuilder.CreateIndex( name: "IX_Donation_SponsorMemberID_ReceiverMemberID", table: "Donation", columns: new[] { "SponsorMemberID", "ReceiverMemberID" }); migrationBuilder.CreateIndex( name: "IX_DonationAlert_CorrelationID", table: "DonationAlert", column: "CorrelationID", unique: true); migrationBuilder.CreateIndex( name: "IX_DonationAlert_DonationID", table: "DonationAlert", column: "DonationID", unique: true); migrationBuilder.CreateIndex( name: "IX_DonationAlert_ReceiverMemberID_Status_CreatedAt", table: "DonationAlert", columns: new[] { "ReceiverMemberID", "Status", "CreatedAt" }, descending: new[] { false, false, true }); migrationBuilder.CreateIndex( name: "IX_DonationAlert_SponsorMemberID", table: "DonationAlert", column: "SponsorMemberID"); migrationBuilder.CreateIndex( name: "IX_DonationAlert_Status", table: "DonationAlert", column: "Status"); migrationBuilder.CreateIndex( name: "IX_DonationAlertAttempt_DonationAlertID", table: "DonationAlertAttempt", column: "DonationAlertID"); migrationBuilder.CreateIndex( name: "IX_DonationAlertAttempt_DonationID_DonationAlertID", table: "DonationAlertAttempt", columns: new[] { "DonationID", "DonationAlertID" }); migrationBuilder.CreateIndex( name: "IX_DonationAlertConfig_ChannelID_IsActive", table: "DonationAlertConfig", columns: new[] { "ChannelID", "IsActive" }); migrationBuilder.CreateIndex( name: "IX_DonationAlertConfig_ChannelID_MatchType_Amount", table: "DonationAlertConfig", columns: new[] { "ChannelID", "MatchType", "Amount" }); migrationBuilder.CreateIndex( name: "IX_DonationAlertConfig_ChannelID_MemberID_Amount", table: "DonationAlertConfig", columns: new[] { "ChannelID", "MemberID", "Amount" }); migrationBuilder.CreateIndex( name: "IX_DonationAlertConfig_MemberID", table: "DonationAlertConfig", column: "MemberID"); migrationBuilder.CreateIndex( name: "IX_DonationGoalConfig_ChannelID_IsActive", table: "DonationGoalConfig", columns: new[] { "ChannelID", "IsActive" }); migrationBuilder.CreateIndex( name: "IX_DonationGoalConfig_ChannelID_MemberID", table: "DonationGoalConfig", columns: new[] { "ChannelID", "MemberID" }); migrationBuilder.CreateIndex( name: "IX_DonationGoalConfig_MemberID", table: "DonationGoalConfig", column: "MemberID"); migrationBuilder.CreateIndex( name: "IX_DonationMeta_ChannelID_MemberID", table: "DonationMeta", columns: new[] { "ChannelID", "MemberID" }, unique: true); migrationBuilder.CreateIndex( name: "IX_DonationMeta_MemberID", table: "DonationMeta", column: "MemberID"); migrationBuilder.CreateIndex( name: "IX_DonationRankConfig_ChannelID", table: "DonationRankConfig", column: "ChannelID"); migrationBuilder.CreateIndex( name: "IX_DonationRankConfig_MemberID", table: "DonationRankConfig", column: "MemberID"); migrationBuilder.CreateIndex( name: "IX_DonationRanking_ChannelID_PeriodType_PeriodStart_Rank", table: "DonationRanking", columns: new[] { "ChannelID", "PeriodType", "PeriodStart", "Rank" }); migrationBuilder.CreateIndex( name: "IX_DonationRanking_ChannelID_SponsorMemberID_PeriodType_PeriodStart", table: "DonationRanking", columns: new[] { "ChannelID", "SponsorMemberID", "PeriodType", "PeriodStart" }, unique: true); migrationBuilder.CreateIndex( name: "IX_DonationRanking_SponsorMemberID", table: "DonationRanking", column: "SponsorMemberID"); migrationBuilder.CreateIndex( name: "IX_DonorChannelStats_ChannelID_CumulativeAmount", table: "DonorChannelStats", columns: new[] { "ChannelID", "CumulativeAmount" }, descending: new[] { false, true }); migrationBuilder.CreateIndex( name: "IX_DonorTitleSelection_ChannelID", table: "DonorTitleSelection", column: "ChannelID"); migrationBuilder.CreateIndex( name: "IX_DonorTitleSelection_DonorMemberID_ChannelID", table: "DonorTitleSelection", columns: new[] { "DonorMemberID", "ChannelID" }, unique: true); migrationBuilder.CreateIndex( name: "IX_DonorTitleSelection_SelectedTitleID", table: "DonorTitleSelection", column: "SelectedTitleID"); migrationBuilder.CreateIndex( name: "IX_GameProductCatalog_GameID_ProductID", table: "GameProductCatalog", columns: new[] { "GameID", "ProductID" }, unique: true); migrationBuilder.CreateIndex( name: "IX_NiceAuthSession_DeveloperID_CreatedAt", table: "NiceAuthSession", columns: new[] { "DeveloperID", "CreatedAt" }); migrationBuilder.CreateIndex( name: "IX_NiceAuthSession_SessionToken", table: "NiceAuthSession", column: "SessionToken", unique: true); migrationBuilder.CreateIndex( name: "IX_NiceAuthSession_Status", table: "NiceAuthSession", column: "Status"); migrationBuilder.CreateIndex( name: "IX_RankingSnapshot_MemberID", table: "RankingSnapshot", column: "MemberID"); migrationBuilder.CreateIndex( name: "IX_RankingSnapshot_SnapshotAt", table: "RankingSnapshot", column: "SnapshotAt", descending: new bool[0]); migrationBuilder.CreateIndex( name: "IX_RankingSnapshot_Type_Period_Category_MemberID", table: "RankingSnapshot", columns: new[] { "Type", "Period", "Category", "MemberID" }, unique: true, filter: "[Category] IS NOT NULL"); migrationBuilder.CreateIndex( name: "IX_RankingSnapshot_Type_Period_Category_Rank", table: "RankingSnapshot", columns: new[] { "Type", "Period", "Category", "Rank" }); migrationBuilder.CreateIndex( name: "IX_Settlement_ChannelID_PeriodStart_PeriodEnd", table: "Settlement", columns: new[] { "ChannelID", "PeriodStart", "PeriodEnd" }); migrationBuilder.CreateIndex( name: "IX_Settlement_MemberID", table: "Settlement", column: "MemberID"); migrationBuilder.CreateIndex( name: "IX_Settlement_Status", table: "Settlement", column: "Status"); migrationBuilder.CreateIndex( name: "IX_SettlementAccount_ChannelID_MemberID", table: "SettlementAccount", columns: new[] { "ChannelID", "MemberID" }); migrationBuilder.CreateIndex( name: "IX_SettlementAccount_MemberID", table: "SettlementAccount", column: "MemberID"); migrationBuilder.CreateIndex( name: "IX_WithdrawalRequest_ChannelID", table: "WithdrawalRequest", column: "ChannelID"); migrationBuilder.CreateIndex( name: "IX_WithdrawalRequest_MemberID_RequestedAt", table: "WithdrawalRequest", columns: new[] { "MemberID", "RequestedAt" }); migrationBuilder.CreateIndex( name: "IX_WithdrawalRequest_MemberID_Status", table: "WithdrawalRequest", columns: new[] { "MemberID", "Status" }); } } }