Fixed bug where deletes of artifact groupings would not cascade

This commit is contained in:
Vincent Allen
2025-11-12 19:10:35 -05:00
parent b34449808f
commit 9298829db6
325 changed files with 5233 additions and 20996 deletions

View File

@@ -0,0 +1,41 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class FixedBlogPostFileCascade : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactFilePaths_BlogPosts_ParentBlogPostId",
table: "ArtifactFilePaths");
migrationBuilder.AddForeignKey(
name: "FK_ArtifactFilePaths_BlogPosts_ParentBlogPostId",
table: "ArtifactFilePaths",
column: "ParentBlogPostId",
principalTable: "BlogPosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactFilePaths_BlogPosts_ParentBlogPostId",
table: "ArtifactFilePaths");
migrationBuilder.AddForeignKey(
name: "FK_ArtifactFilePaths_BlogPosts_ParentBlogPostId",
table: "ArtifactFilePaths",
column: "ParentBlogPostId",
principalTable: "BlogPosts",
principalColumn: "Id");
}
}
}