1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

[PM-14590] Modify Notification database table (#5361)

* Added notification type enum

Added option type to entity

* created migration files

* made sprocs backward compatible

* made sprocs backward compatible

* Fixed linting

* Altered table to require an optional taskId

* formatted code

* Added foreignkey

* Formatted code

* fixed order
This commit is contained in:
SmithThe4th
2025-02-10 11:39:48 -05:00
committed by GitHub
parent e4d862fe6e
commit bde11dae31
16 changed files with 9330 additions and 6 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,47 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.PostgresMigrations.Migrations;
/// <inheritdoc />
public partial class AddOptionalNotifificationTaskId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "TaskId",
table: "Notification",
type: "uuid",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Notification_TaskId",
table: "Notification",
column: "TaskId");
migrationBuilder.AddForeignKey(
name: "FK_Notification_SecurityTask_TaskId",
table: "Notification",
column: "TaskId",
principalTable: "SecurityTask",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Notification_SecurityTask_TaskId",
table: "Notification");
migrationBuilder.DropIndex(
name: "IX_Notification_TaskId",
table: "Notification");
migrationBuilder.DropColumn(
name: "TaskId",
table: "Notification");
}
}

View File

@ -1680,6 +1680,9 @@ namespace Bit.PostgresMigrations.Migrations
b.Property<DateTime>("RevisionDate")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("TaskId")
.HasColumnType("uuid");
b.Property<string>("Title")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
@ -1693,6 +1696,9 @@ namespace Bit.PostgresMigrations.Migrations
b.HasIndex("OrganizationId")
.HasAnnotation("SqlServer:Clustered", false);
b.HasIndex("TaskId")
.HasAnnotation("SqlServer:Clustered", false);
b.HasIndex("UserId")
.HasAnnotation("SqlServer:Clustered", false);
@ -2634,12 +2640,18 @@ namespace Bit.PostgresMigrations.Migrations
.WithMany()
.HasForeignKey("OrganizationId");
b.HasOne("Bit.Infrastructure.EntityFramework.Vault.Models.SecurityTask", "Task")
.WithMany()
.HasForeignKey("TaskId");
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany()
.HasForeignKey("UserId");
b.Navigation("Organization");
b.Navigation("Task");
b.Navigation("User");
});