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

[PM-10560] Create notification database storage (#4688)

* Add new tables

* Add stored procedures

* Add core entities and models

* Setup EF

* Add repository interfaces

* Add dapper repos

* Add EF repos

* Add order by

* EF updates

* PM-10560: Notifications repository matching requirements.

* PM-10560: Notifications repository matching requirements.

* PM-10560: Migration scripts

* PM-10560: EF index optimizations

* PM-10560: Cleanup

* PM-10560: Priority in natural order, Repository, sql simplifications

* PM-10560: Title column update

* PM-10560: Incorrect EF migration removal

* PM-10560: EF migrations

* PM-10560: Added views, SP naming simplification

* PM-10560: Notification entity Title update, EF migrations

* PM-10560: Removing Notification_ReadByUserId

* PM-10560: Notification ReadByUserIdAndStatus fix

* PM-10560: Notification ReadByUserIdAndStatus fix to be in line with requirements and EF

---------

Co-authored-by: Maciej Zieniuk <mzieniuk@bitwarden.com>
Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
This commit is contained in:
Thomas Avery
2024-09-09 14:52:12 -05:00
committed by GitHub
parent 55bf815050
commit 4c0f8d54f3
39 changed files with 9983 additions and 0 deletions

View File

@ -1588,6 +1588,77 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("User", (string)null);
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.NotificationCenter.Models.Notification", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
b.Property<string>("Body")
.HasColumnType("longtext");
b.Property<byte>("ClientType")
.HasColumnType("tinyint unsigned");
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime(6)");
b.Property<bool>("Global")
.HasColumnType("tinyint(1)");
b.Property<Guid?>("OrganizationId")
.HasColumnType("char(36)");
b.Property<byte>("Priority")
.HasColumnType("tinyint unsigned");
b.Property<DateTime>("RevisionDate")
.HasColumnType("datetime(6)");
b.Property<string>("Title")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<Guid?>("UserId")
.HasColumnType("char(36)");
b.HasKey("Id")
.HasAnnotation("SqlServer:Clustered", true);
b.HasIndex("OrganizationId")
.HasAnnotation("SqlServer:Clustered", false);
b.HasIndex("UserId")
.HasAnnotation("SqlServer:Clustered", false);
b.HasIndex("ClientType", "Global", "UserId", "OrganizationId", "Priority", "CreationDate")
.IsDescending(false, false, false, false, true, true)
.HasAnnotation("SqlServer:Clustered", false);
b.ToTable("Notification", (string)null);
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.NotificationCenter.Models.NotificationStatus", b =>
{
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.Property<Guid>("NotificationId")
.HasColumnType("char(36)");
b.Property<DateTime?>("DeletedDate")
.HasColumnType("datetime(6)");
b.Property<DateTime?>("ReadDate")
.HasColumnType("datetime(6)");
b.HasKey("UserId", "NotificationId")
.HasAnnotation("SqlServer:Clustered", true);
b.HasIndex("NotificationId");
b.ToTable("NotificationStatus", (string)null);
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.SecretsManager.Models.AccessPolicy", b =>
{
b.Property<Guid>("Id")
@ -2380,6 +2451,40 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.NotificationCenter.Models.Notification", b =>
{
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
.WithMany()
.HasForeignKey("OrganizationId");
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany()
.HasForeignKey("UserId");
b.Navigation("Organization");
b.Navigation("User");
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.NotificationCenter.Models.NotificationStatus", b =>
{
b.HasOne("Bit.Infrastructure.EntityFramework.NotificationCenter.Models.Notification", "Notification")
.WithMany()
.HasForeignKey("NotificationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Notification");
b.Navigation("User");
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.SecretsManager.Models.ApiKey", b =>
{
b.HasOne("Bit.Infrastructure.EntityFramework.SecretsManager.Models.ServiceAccount", "ServiceAccount")