using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Aberwyn.Migrations
{
    public partial class AddBudgetItemDefinitions : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_BudgetCategories_BudgetCategoryDefinition_BudgetCategoryDefi~",
                table: "BudgetCategories");

            migrationBuilder.DropForeignKey(
                name: "FK_BudgetItems_BudgetItemDefinition_BudgetItemDefinitionId",
                table: "BudgetItems");

            migrationBuilder.DropPrimaryKey(
                name: "PK_BudgetItemDefinition",
                table: "BudgetItemDefinition");

            migrationBuilder.DropPrimaryKey(
                name: "PK_BudgetCategoryDefinition",
                table: "BudgetCategoryDefinition");

            migrationBuilder.RenameTable(
                name: "BudgetItemDefinition",
                newName: "BudgetItemDefinitions");

            migrationBuilder.RenameTable(
                name: "BudgetCategoryDefinition",
                newName: "BudgetCategoryDefinitions");

            migrationBuilder.AddPrimaryKey(
                name: "PK_BudgetItemDefinitions",
                table: "BudgetItemDefinitions",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_BudgetCategoryDefinitions",
                table: "BudgetCategoryDefinitions",
                column: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_BudgetCategories_BudgetCategoryDefinitions_BudgetCategoryDef~",
                table: "BudgetCategories",
                column: "BudgetCategoryDefinitionId",
                principalTable: "BudgetCategoryDefinitions",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_BudgetItems_BudgetItemDefinitions_BudgetItemDefinitionId",
                table: "BudgetItems",
                column: "BudgetItemDefinitionId",
                principalTable: "BudgetItemDefinitions",
                principalColumn: "Id");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_BudgetCategories_BudgetCategoryDefinitions_BudgetCategoryDef~",
                table: "BudgetCategories");

            migrationBuilder.DropForeignKey(
                name: "FK_BudgetItems_BudgetItemDefinitions_BudgetItemDefinitionId",
                table: "BudgetItems");

            migrationBuilder.DropPrimaryKey(
                name: "PK_BudgetItemDefinitions",
                table: "BudgetItemDefinitions");

            migrationBuilder.DropPrimaryKey(
                name: "PK_BudgetCategoryDefinitions",
                table: "BudgetCategoryDefinitions");

            migrationBuilder.RenameTable(
                name: "BudgetItemDefinitions",
                newName: "BudgetItemDefinition");

            migrationBuilder.RenameTable(
                name: "BudgetCategoryDefinitions",
                newName: "BudgetCategoryDefinition");

            migrationBuilder.AddPrimaryKey(
                name: "PK_BudgetItemDefinition",
                table: "BudgetItemDefinition",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_BudgetCategoryDefinition",
                table: "BudgetCategoryDefinition",
                column: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_BudgetCategories_BudgetCategoryDefinition_BudgetCategoryDefi~",
                table: "BudgetCategories",
                column: "BudgetCategoryDefinitionId",
                principalTable: "BudgetCategoryDefinition",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_BudgetItems_BudgetItemDefinition_BudgetItemDefinitionId",
                table: "BudgetItems",
                column: "BudgetItemDefinitionId",
                principalTable: "BudgetItemDefinition",
                principalColumn: "Id");
        }
    }
}
