mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[PM-20064] Add cascade deletion for cipher with tasks (#5690)
* add cascade deletion for cipher tasks * add migrations for cascade delete on ciphers and security tasks * remove trailing comma * add SQL migration for PasswordHealthReportApplication - Allow cascade delete when an organization is deleted
This commit is contained in:
@ -0,0 +1,40 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.PostgresMigrations.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class SecurityTaskCascadeDelete : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SecurityTask_Cipher_CipherId",
|
||||
table: "SecurityTask");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SecurityTask_Cipher_CipherId",
|
||||
table: "SecurityTask",
|
||||
column: "CipherId",
|
||||
principalTable: "Cipher",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SecurityTask_Cipher_CipherId",
|
||||
table: "SecurityTask");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SecurityTask_Cipher_CipherId",
|
||||
table: "SecurityTask",
|
||||
column: "CipherId",
|
||||
principalTable: "Cipher",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user