using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Persistence.Migrations
{
///
public partial class AddDonation : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterTable(
name: "Channel",
comment: "� ����",
oldComment: "채널 정보");
migrationBuilder.AlterColumn(
name: "YouTubeUrl",
table: "Channel",
type: "nvarchar(255)",
maxLength: 255,
nullable: false,
comment: "YouTube � URL",
oldClrType: typeof(string),
oldType: "nvarchar(255)",
oldMaxLength: 255,
oldComment: "YouTube 채널 URL");
migrationBuilder.AlterColumn(
name: "UpdatedAt",
table: "Channel",
type: "datetime2",
nullable: true,
comment: "���� �Ͻ�",
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldNullable: true,
oldComment: "수정 일시");
migrationBuilder.AlterColumn(
name: "SID",
table: "Channel",
type: "nvarchar(24)",
maxLength: 24,
nullable: false,
comment: "� ID",
oldClrType: typeof(string),
oldType: "nvarchar(24)",
oldMaxLength: 24,
oldComment: "채널 ID");
migrationBuilder.AlterColumn(
name: "PlatformFeeRate",
table: "Channel",
type: "decimal(5,2)",
precision: 5,
scale: 2,
nullable: false,
comment: "������(%)",
oldClrType: typeof(decimal),
oldType: "decimal(5,2)",
oldPrecision: 5,
oldScale: 2,
oldComment: "수수료(%)");
migrationBuilder.AlterColumn(
name: "Name",
table: "Channel",
type: "nvarchar(200)",
maxLength: 200,
nullable: false,
comment: "ä�� �̸�",
oldClrType: typeof(string),
oldType: "nvarchar(200)",
oldMaxLength: 200,
oldComment: "채널 이름");
migrationBuilder.AlterColumn(
name: "MemberID",
table: "Channel",
type: "int",
nullable: false,
comment: "ȸ�� ID",
oldClrType: typeof(int),
oldType: "int",
oldComment: "회원 ID");
migrationBuilder.AlterColumn(
name: "IsVerified",
table: "Channel",
type: "bit",
nullable: false,
comment: "���� ����",
oldClrType: typeof(bool),
oldType: "bit",
oldComment: "인증 여부");
migrationBuilder.AlterColumn(
name: "IsActive",
table: "Channel",
type: "bit",
nullable: false,
comment: "Ȱ�� ����",
oldClrType: typeof(bool),
oldType: "bit",
oldComment: "활성 여부");
migrationBuilder.AlterColumn(
name: "Handle",
table: "Channel",
type: "nvarchar(30)",
maxLength: 30,
nullable: true,
comment: "�ڵ�",
oldClrType: typeof(string),
oldType: "nvarchar(30)",
oldMaxLength: 30,
oldNullable: true,
oldComment: "핸들");
migrationBuilder.AlterColumn(
name: "CreatedAt",
table: "Channel",
type: "datetime2",
nullable: false,
comment: "��� �Ͻ�",
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldComment: "등록 일시");
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),
Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false),
Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true),
MinAmount = table.Column(type: "int", nullable: true),
IsActive = table.Column(type: "bit", nullable: false),
UpdatedAt = table.Column(type: "datetime2", nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false)
},
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: "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),
Title = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false),
Amount = table.Column(type: "int", nullable: false),
Sound = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true),
Message = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false),
PlayDelaySec = table.Column(type: "float", nullable: false),
DisplayDurationSec = table.Column(type: "float", nullable: false),
EnableThumbnail = table.Column(type: "bit", nullable: false),
ThumbnailUrl = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true),
IsActive = table.Column(type: "bit", nullable: false),
UpdatedAt = table.Column(type: "datetime2", nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false)
},
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),
Title = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false),
Style = table.Column(type: "int", nullable: false),
StartAmount = table.Column(type: "int", nullable: false),
TargetAmount = table.Column(type: "int", nullable: false),
StartAt = table.Column(type: "datetime2", nullable: true),
EndAt = table.Column(type: "datetime2", nullable: true),
IsShowPercent = table.Column(type: "bit", nullable: false),
BarColor = table.Column(type: "nvarchar(9)", maxLength: 9, nullable: false),
BarBackgroundColor = table.Column(type: "nvarchar(9)", maxLength: 9, nullable: false),
BarHeightPx = table.Column(type: "int", nullable: false),
TitleFontSizePx = table.Column(type: "int", nullable: false),
TitleFontColor = table.Column(type: "nvarchar(9)", maxLength: 9, nullable: false),
AmountFontSizePx = table.Column(type: "int", nullable: false),
AmountFontColor = table.Column(type: "nvarchar(9)", maxLength: 9, nullable: false),
IsActive = table.Column(type: "bit", nullable: false),
UpdatedAt = table.Column(type: "datetime2", nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false)
},
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),
MinAmount = table.Column(type: "int", nullable: false),
IsPaused = table.Column(type: "bit", nullable: false),
IsAccepting = table.Column(type: "bit", nullable: false),
IsAudioOnly = table.Column(type: "bit", nullable: false),
IsVideoOnly = table.Column(type: "bit", nullable: false),
UpdatedAt = table.Column(type: "datetime2", nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false)
},
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),
Title = table.Column(type: "nvarchar(300)", maxLength: 300, nullable: false),
Theme = table.Column(type: "int", nullable: false),
Period = table.Column(type: "int", nullable: false),
StartAt = table.Column(type: "datetime2", nullable: true),
EndAt = table.Column(type: "datetime2", nullable: true),
IsShowAmount = table.Column(type: "bit", nullable: false),
MaxRankCount = table.Column(type: "int", nullable: false),
NameMode = table.Column(type: "bit", nullable: true),
IsActive = table.Column(type: "bit", nullable: false),
UpdatedAt = table.Column(type: "datetime2", nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false)
},
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),
PeriodType = table.Column(type: "int", nullable: false),
PeriodStart = table.Column(type: "datetime2", nullable: false),
PeriodEnd = table.Column(type: "datetime2", nullable: true),
Rank = table.Column(type: "int", nullable: false),
TotalAmount = table.Column(type: "int", nullable: false),
DonationCount = table.Column(type: "int", nullable: false),
SponsorName = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false),
IsActive = table.Column(type: "bit", nullable: false),
UpdatedAt = table.Column(type: "datetime2", nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false)
},
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: "MemberOAuthToken",
columns: table => new
{
ID = table.Column(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
MemberID = table.Column(type: "int", nullable: false),
Provider = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: false),
AccessTokenEnc = table.Column(type: "nvarchar(2048)", maxLength: 2048, nullable: false),
RefreshTokenEnc = table.Column(type: "nvarchar(2048)", maxLength: 2048, nullable: true),
ExpiresAt = table.Column(type: "datetime2", nullable: false),
Scopes = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: false),
CreatedAt = table.Column(type: "datetime2", nullable: false),
UpdatedAt = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_MemberOAuthToken", x => x.ID);
table.ForeignKey(
name: "FK_MemberOAuthToken_Member_MemberID",
column: x => x.MemberID,
principalTable: "Member",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
},
comment: "회원 OAuth 토큰");
migrationBuilder.CreateTable(
name: "Note",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
SenderMemberID = table.Column(type: "int", nullable: false),
ReceiverMemberID = table.Column(type: "int", nullable: false),
Title = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false),
Content = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false),
IsRead = table.Column(type: "bit", nullable: false),
IsDeletedBySender = table.Column(type: "bit", nullable: false),
IsDeletedByReceiver = table.Column(type: "bit", nullable: false),
IsSystem = table.Column(type: "bit", nullable: false),
RelatedType = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true),
RelatedID = table.Column(type: "int", nullable: true),
ReadAt = table.Column(type: "datetime2", nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Note", x => x.ID);
table.ForeignKey(
name: "FK_Note_Member_ReceiverMemberID",
column: x => x.ReceiverMemberID,
principalTable: "Member",
principalColumn: "ID");
table.ForeignKey(
name: "FK_Note_Member_SenderMemberID",
column: x => x.SenderMemberID,
principalTable: "Member",
principalColumn: "ID");
},
comment: "쪽지");
migrationBuilder.CreateTable(
name: "Notification",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
MemberID = table.Column(type: "int", nullable: false),
Type = table.Column(type: "int", nullable: false),
Title = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false),
Message = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false),
IsRead = table.Column(type: "bit", nullable: false),
ActionUrl = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true),
RelatedType = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true),
RelatedID = table.Column(type: "int", nullable: true),
ImageUrl = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true),
ReadAt = table.Column(type: "datetime2", nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Notification", x => x.ID);
table.ForeignKey(
name: "FK_Notification_Member_MemberID",
column: x => x.MemberID,
principalTable: "Member",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
},
comment: "알림");
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),
PeriodStart = table.Column(type: "datetime2", nullable: false),
PeriodEnd = table.Column(type: "datetime2", nullable: false),
GrossAmount = table.Column(type: "int", nullable: false),
FeeAmount = table.Column(type: "int", nullable: false),
NetAmount = table.Column(type: "int", nullable: false),
Status = table.Column(type: "int", nullable: false),
RequestedAt = table.Column(type: "datetime2", nullable: false),
ApprovedAt = table.Column(type: "datetime2", nullable: true),
PaidAt = table.Column(type: "datetime2", nullable: true),
AdminMemo = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true)
},
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: "CrewMember",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CrewID = table.Column(type: "int", nullable: false),
MemberID = table.Column(type: "int", nullable: false),
ChannelID = table.Column(type: "int", nullable: true),
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),
IsActive = table.Column(type: "bit", nullable: false),
JoinedAt = table.Column(type: "datetime2", 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),
Title = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false),
Status = table.Column(type: "int", nullable: false),
StartedAt = table.Column(type: "datetime2", nullable: true),
EndedAt = table.Column(type: "datetime2", nullable: true),
TotalAmount = table.Column(type: "int", nullable: false),
TotalDonationCount = table.Column(type: "int", nullable: false),
CreatedAt = table.Column(type: "datetime2", 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: "CrewDonationSummary",
columns: table => new
{
ID = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CrewSessionID = table.Column(type: "int", nullable: false),
CrewMemberID = table.Column(type: "int", nullable: false),
TotalAmount = table.Column(type: "int", nullable: false),
DonationCount = table.Column(type: "int", nullable: false),
ContributionRate = table.Column(type: "decimal(5,2)", precision: 5, scale: 2, nullable: false),
Rank = table.Column(type: "int", nullable: false),
UpdatedAt = table.Column(type: "datetime2", nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false)
},
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"),
CrewSessionID = table.Column(type: "int", nullable: false),
CrewMemberID = table.Column(type: "int", nullable: false),
IsConsented = table.Column(type: "bit", nullable: false),
ConsentedAt = table.Column(type: "datetime2", nullable: true),
CreatedAt = table.Column(type: "datetime2", 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"),
SponsorMemberID = table.Column(type: "int", nullable: false),
ReceiverMemberID = table.Column(type: "int", nullable: false),
ChannelID = table.Column(type: "int", nullable: false),
CrewSessionID = table.Column(type: "int", nullable: true),
CrewMemberID = table.Column(type: "int", nullable: true),
Amount = table.Column(type: "int", nullable: false),
FeeRate = table.Column(type: "decimal(5,2)", precision: 5, scale: 2, nullable: false),
FeeAmount = table.Column(type: "int", nullable: false),
NetAmount = table.Column(type: "int", nullable: false),
Message = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true),
SendName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false),
IsTest = table.Column(type: "bit", nullable: false),
CreatedAt = table.Column(type: "datetime2", 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),
SponsorMemberID = table.Column(type: "int", nullable: false),
ReceiverMemberID = table.Column(type: "int", nullable: false),
Status = table.Column(type: "int", nullable: false),
CorrelationID = table.Column(type: "uniqueidentifier", nullable: false),
StartAt = table.Column(type: "datetime2", nullable: false),
ArrivedAt = table.Column(type: "datetime2", nullable: true),
TotalDelayMs = table.Column(type: "float", nullable: true),
IpAddress = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true),
UserAgent = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true),
CreatedAt = table.Column(type: "datetime2", nullable: false)
},
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"),
DonationID = table.Column(type: "int", nullable: false),
DonationAlertID = table.Column(type: "int", nullable: false),
IpAddress = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true),
UserAgent = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: true),
SentAt = table.Column(type: "datetime2", nullable: false)
},
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_Crew_ChannelID_IsActive",
table: "Crew",
columns: new[] { "ChannelID", "IsActive" });
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_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_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_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_MemberID",
table: "DonationRankConfig",
columns: new[] { "ChannelID", "MemberID" },
unique: true);
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_MemberOAuthToken_MemberID_Provider",
table: "MemberOAuthToken",
columns: new[] { "MemberID", "Provider" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Note_ReceiverMemberID_IsDeletedByReceiver_IsRead_CreatedAt",
table: "Note",
columns: new[] { "ReceiverMemberID", "IsDeletedByReceiver", "IsRead", "CreatedAt" },
descending: new[] { false, false, false, true });
migrationBuilder.CreateIndex(
name: "IX_Note_SenderMemberID_IsDeletedBySender_CreatedAt",
table: "Note",
columns: new[] { "SenderMemberID", "IsDeletedBySender", "CreatedAt" },
descending: new[] { false, false, true });
migrationBuilder.CreateIndex(
name: "IX_Notification_MemberID_IsRead_CreatedAt",
table: "Notification",
columns: new[] { "MemberID", "IsRead", "CreatedAt" },
descending: new[] { false, false, true });
migrationBuilder.CreateIndex(
name: "IX_Notification_MemberID_Type_CreatedAt",
table: "Notification",
columns: new[] { "MemberID", "Type", "CreatedAt" },
descending: new[] { false, false, true });
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");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CrewDonationSummary");
migrationBuilder.DropTable(
name: "CrewSessionConsent");
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: "MemberOAuthToken");
migrationBuilder.DropTable(
name: "Note");
migrationBuilder.DropTable(
name: "Notification");
migrationBuilder.DropTable(
name: "Settlement");
migrationBuilder.DropTable(
name: "DonationAlert");
migrationBuilder.DropTable(
name: "Donation");
migrationBuilder.DropTable(
name: "CrewMember");
migrationBuilder.DropTable(
name: "CrewSession");
migrationBuilder.DropTable(
name: "Crew");
migrationBuilder.AlterTable(
name: "Channel",
comment: "채널 정보",
oldComment: "� ����");
migrationBuilder.AlterColumn(
name: "YouTubeUrl",
table: "Channel",
type: "nvarchar(255)",
maxLength: 255,
nullable: false,
comment: "YouTube 채널 URL",
oldClrType: typeof(string),
oldType: "nvarchar(255)",
oldMaxLength: 255,
oldComment: "YouTube � URL");
migrationBuilder.AlterColumn(
name: "UpdatedAt",
table: "Channel",
type: "datetime2",
nullable: true,
comment: "수정 일시",
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldNullable: true,
oldComment: "���� �Ͻ�");
migrationBuilder.AlterColumn(
name: "SID",
table: "Channel",
type: "nvarchar(24)",
maxLength: 24,
nullable: false,
comment: "채널 ID",
oldClrType: typeof(string),
oldType: "nvarchar(24)",
oldMaxLength: 24,
oldComment: "� ID");
migrationBuilder.AlterColumn(
name: "PlatformFeeRate",
table: "Channel",
type: "decimal(5,2)",
precision: 5,
scale: 2,
nullable: false,
comment: "수수료(%)",
oldClrType: typeof(decimal),
oldType: "decimal(5,2)",
oldPrecision: 5,
oldScale: 2,
oldComment: "������(%)");
migrationBuilder.AlterColumn(
name: "Name",
table: "Channel",
type: "nvarchar(200)",
maxLength: 200,
nullable: false,
comment: "채널 이름",
oldClrType: typeof(string),
oldType: "nvarchar(200)",
oldMaxLength: 200,
oldComment: "ä�� �̸�");
migrationBuilder.AlterColumn(
name: "MemberID",
table: "Channel",
type: "int",
nullable: false,
comment: "회원 ID",
oldClrType: typeof(int),
oldType: "int",
oldComment: "ȸ�� ID");
migrationBuilder.AlterColumn(
name: "IsVerified",
table: "Channel",
type: "bit",
nullable: false,
comment: "인증 여부",
oldClrType: typeof(bool),
oldType: "bit",
oldComment: "���� ����");
migrationBuilder.AlterColumn(
name: "IsActive",
table: "Channel",
type: "bit",
nullable: false,
comment: "활성 여부",
oldClrType: typeof(bool),
oldType: "bit",
oldComment: "Ȱ�� ����");
migrationBuilder.AlterColumn(
name: "Handle",
table: "Channel",
type: "nvarchar(30)",
maxLength: 30,
nullable: true,
comment: "핸들",
oldClrType: typeof(string),
oldType: "nvarchar(30)",
oldMaxLength: 30,
oldNullable: true,
oldComment: "�ڵ�");
migrationBuilder.AlterColumn(
name: "CreatedAt",
table: "Channel",
type: "datetime2",
nullable: false,
comment: "등록 일시",
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldComment: "��� �Ͻ�");
}
}
}