using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Infrastructure.Migrations.AppDb
{
    /// <inheritdoc />
    public partial class AddCrewWidgetConfig : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "CrewWidgetConfig",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ChannelID = table.Column<int>(type: "int", nullable: false),
                    MemberID = table.Column<int>(type: "int", nullable: false),
                    Title = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: false),
                    Theme = table.Column<int>(type: "int", nullable: false),
                    Period = table.Column<int>(type: "int", nullable: false),
                    StartAt = table.Column<DateTime>(type: "datetime2", nullable: true),
                    EndAt = table.Column<DateTime>(type: "datetime2", nullable: true),
                    MaxDisplayCount = table.Column<int>(type: "int", nullable: false),
                    IsShowAmount = table.Column<bool>(type: "bit", nullable: false),
                    IsShowDonationCount = table.Column<bool>(type: "bit", nullable: false),
                    IsShowContributionRate = table.Column<bool>(type: "bit", nullable: false),
                    IsShowMemberIcon = table.Column<bool>(type: "bit", nullable: false),
                    IsActive = table.Column<bool>(type: "bit", nullable: false),
                    BgColor = table.Column<string>(type: "nvarchar(7)", maxLength: 7, nullable: false),
                    TitleFontFamily = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TitleFontSizePx = table.Column<int>(type: "int", nullable: false),
                    TitleFontColor = table.Column<string>(type: "nvarchar(7)", maxLength: 7, nullable: false),
                    Rank1FontFamily = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Rank1FontSizePx = table.Column<int>(type: "int", nullable: false),
                    Rank1FontColor = table.Column<string>(type: "nvarchar(7)", maxLength: 7, nullable: false),
                    Rank2FontFamily = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Rank2FontSizePx = table.Column<int>(type: "int", nullable: false),
                    Rank2FontColor = table.Column<string>(type: "nvarchar(7)", maxLength: 7, nullable: false),
                    Rank3FontFamily = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Rank3FontSizePx = table.Column<int>(type: "int", nullable: false),
                    Rank3FontColor = table.Column<string>(type: "nvarchar(7)", maxLength: 7, nullable: false),
                    RowFontFamily = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RowFontSizePx = table.Column<int>(type: "int", nullable: false),
                    RowFontColor = table.Column<string>(type: "nvarchar(7)", maxLength: 7, nullable: false),
                    UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                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_Member_MemberID",
                        column: x => x.MemberID,
                        principalTable: "Member",
                        principalColumn: "ID");
                },
                comment: "크루 위젯 설정");

            migrationBuilder.CreateIndex(
                name: "IX_CrewWidgetConfig_ChannelID",
                table: "CrewWidgetConfig",
                column: "ChannelID");

            migrationBuilder.CreateIndex(
                name: "IX_CrewWidgetConfig_MemberID",
                table: "CrewWidgetConfig",
                column: "MemberID");
        }

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