mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
fix: null user/paste fk in reports on delete
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SharpbinV3.Server.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class NullOnUserPasteDeletion : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Reports_Pastes_PastePID",
|
||||
table: "Reports");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Reports_Users_UserUUID",
|
||||
table: "Reports");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Reports_Pastes_PastePID",
|
||||
table: "Reports",
|
||||
column: "PastePID",
|
||||
principalTable: "Pastes",
|
||||
principalColumn: "PID",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Reports_Users_UserUUID",
|
||||
table: "Reports",
|
||||
column: "UserUUID",
|
||||
principalTable: "Users",
|
||||
principalColumn: "UUID",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Reports_Pastes_PastePID",
|
||||
table: "Reports");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Reports_Users_UserUUID",
|
||||
table: "Reports");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Reports_Pastes_PastePID",
|
||||
table: "Reports",
|
||||
column: "PastePID",
|
||||
principalTable: "Pastes",
|
||||
principalColumn: "PID");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Reports_Users_UserUUID",
|
||||
table: "Reports",
|
||||
column: "UserUUID",
|
||||
principalTable: "Users",
|
||||
principalColumn: "UUID");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user