using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace OpenArchival.DataAccess.Migrations
{
    /// <inheritdoc />
    public partial class FixErrorFilePathForeignKey : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_ArtifactFilePaths_ArtifactGroupings_ArtifactGroupingId",
                table: "ArtifactFilePaths");

            migrationBuilder.DropIndex(
                name: "IX_ArtifactFilePaths_ArtifactGroupingId",
                table: "ArtifactFilePaths");

            migrationBuilder.DropColumn(
                name: "ArtifactGroupingId",
                table: "ArtifactFilePaths");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "ArtifactGroupingId",
                table: "ArtifactFilePaths",
                type: "integer",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_ArtifactFilePaths_ArtifactGroupingId",
                table: "ArtifactFilePaths",
                column: "ArtifactGroupingId");

            migrationBuilder.AddForeignKey(
                name: "FK_ArtifactFilePaths_ArtifactGroupings_ArtifactGroupingId",
                table: "ArtifactFilePaths",
                column: "ArtifactGroupingId",
                principalTable: "ArtifactGroupings",
                principalColumn: "Id");
        }
    }
}
