using System;
using Backend.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Backend.Migrations
{
    /// <inheritdoc />
    [DbContext(typeof(AwardsDbContext))]
    [Migration("20260625153000_AddCreatorRoleAndTeamTwitchBinding")]
    public partial class AddCreatorRoleAndTeamTwitchBinding : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<string>(
                name: "BoundTwitchDisplayName",
                table: "TeamMembers",
                type: "character varying(120)",
                maxLength: 120,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "BoundTwitchUserId",
                table: "TeamMembers",
                type: "character varying(120)",
                maxLength: 120,
                nullable: true);

            migrationBuilder.AddColumn<DateTimeOffset>(
                name: "TwitchBoundAt",
                table: "TeamMembers",
                type: "timestamp with time zone",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_TeamMembers_BoundTwitchUserId",
                table: "TeamMembers",
                column: "BoundTwitchUserId",
                unique: true,
                filter: "\"BoundTwitchUserId\" IS NOT NULL");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_TeamMembers_BoundTwitchUserId",
                table: "TeamMembers");

            migrationBuilder.DropColumn(
                name: "BoundTwitchDisplayName",
                table: "TeamMembers");

            migrationBuilder.DropColumn(
                name: "BoundTwitchUserId",
                table: "TeamMembers");

            migrationBuilder.DropColumn(
                name: "TwitchBoundAt",
                table: "TeamMembers");
        }
    }
}
