mirror of
https://github.com/bitwarden/server
synced 2025-12-28 14:13:48 +00:00
clean up cipher archive
This commit is contained in:
@@ -163,7 +163,6 @@ public class DatabaseContext : DbContext
|
||||
}
|
||||
|
||||
eCipher.ToTable(nameof(Cipher));
|
||||
eCipherArchive.ToTable(nameof(CipherArchive));
|
||||
eCollection.ToTable(nameof(Collection));
|
||||
eCollectionCipher.ToTable(nameof(CollectionCipher));
|
||||
eEmergencyAccess.ToTable(nameof(EmergencyAccess));
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Bit.Infrastructure.EntityFramework.Vault.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Vault.Configurations;
|
||||
@@ -17,7 +18,12 @@ public class CipherArchiveConfiguration : IEntityTypeConfiguration<CipherArchive
|
||||
.HasForeignKey(ca => ca.CipherId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
// If you want explicit mapping:
|
||||
builder
|
||||
.HasOne(ca => ca.User)
|
||||
.WithMany()
|
||||
.HasForeignKey(ca => ca.UserId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.Property(ca => ca.ArchivedDate).IsRequired();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#nullable disable
|
||||
|
||||
using Bit.Infrastructure.EntityFramework.Vault.Models;
|
||||
using Bit.Infrastructure.EntityFramework.Models;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Vault.Models;
|
||||
|
||||
public class CipherArchive
|
||||
{
|
||||
@@ -8,6 +10,7 @@ public class CipherArchive
|
||||
public Guid UserId { get; set; }
|
||||
public DateTime ArchivedDate { get; set; }
|
||||
|
||||
// Optional navigation props – you can drop these if you don't want them.
|
||||
// Navigation props
|
||||
public Cipher Cipher { get; set; }
|
||||
public User User { get; set; } // optional, matches FK
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user