using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace GameList.Data.Migrations
{
    /// <inheritdoc />
    public partial class AddSuggestionLinks : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "ParentSuggestionId",
                table: "Suggestions",
                type: "INTEGER",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_Suggestions_ParentSuggestionId",
                table: "Suggestions",
                column: "ParentSuggestionId");

            migrationBuilder.AddForeignKey(
                name: "FK_Suggestions_Suggestions_ParentSuggestionId",
                table: "Suggestions",
                column: "ParentSuggestionId",
                principalTable: "Suggestions",
                principalColumn: "Id",
                onDelete: ReferentialAction.SetNull);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Suggestions_Suggestions_ParentSuggestionId",
                table: "Suggestions");

            migrationBuilder.DropIndex(
                name: "IX_Suggestions_ParentSuggestionId",
                table: "Suggestions");

            migrationBuilder.DropColumn(
                name: "ParentSuggestionId",
                table: "Suggestions");
        }
    }
}
