using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace RpgRoller.Migrations
{
    /// <inheritdoc />
    public partial class AddSkillGroupsAndCharacterOwnerTransfer : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "SkillGroupId",
                table: "Skills",
                type: "TEXT",
                nullable: true);

            migrationBuilder.CreateTable(
                name: "SkillGroups",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "TEXT", nullable: false),
                    CharacterId = table.Column<Guid>(type: "TEXT", nullable: false),
                    Name = table.Column<string>(type: "TEXT", maxLength: 128, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SkillGroups", x => x.Id);
                });

            migrationBuilder.CreateIndex(
                name: "IX_Skills_SkillGroupId",
                table: "Skills",
                column: "SkillGroupId");

            migrationBuilder.CreateIndex(
                name: "IX_SkillGroups_CharacterId",
                table: "SkillGroups",
                column: "CharacterId");
        }

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

            migrationBuilder.DropIndex(
                name: "IX_Skills_SkillGroupId",
                table: "Skills");

            migrationBuilder.DropColumn(
                name: "SkillGroupId",
                table: "Skills");
        }
    }
}
