using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace NetinaShop.Repository.Migrations
{
    /// <inheritdoc />
    public partial class editSpecificationNullParent : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Specifications_Specifications_ParentId",
                schema: "public",
                table: "Specifications");

            migrationBuilder.AlterColumn<Guid>(
                name: "ParentId",
                schema: "public",
                table: "Specifications",
                type: "uuid",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uuid");

            migrationBuilder.AddForeignKey(
                name: "FK_Specifications_Specifications_ParentId",
                schema: "public",
                table: "Specifications",
                column: "ParentId",
                principalSchema: "public",
                principalTable: "Specifications",
                principalColumn: "Id");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Specifications_Specifications_ParentId",
                schema: "public",
                table: "Specifications");

            migrationBuilder.AlterColumn<Guid>(
                name: "ParentId",
                schema: "public",
                table: "Specifications",
                type: "uuid",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldNullable: true);

            migrationBuilder.AddForeignKey(
                name: "FK_Specifications_Specifications_ParentId",
                schema: "public",
                table: "Specifications",
                column: "ParentId",
                principalSchema: "public",
                principalTable: "Specifications",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
    }
}
