Workspace Metadata Rows

This commit is contained in:
Jöran Malek 2024-02-16 02:24:25 +01:00
parent e9c6e14965
commit a62b5a1f29
8 changed files with 324 additions and 7 deletions

View file

@ -10,12 +10,28 @@ public class NoteDbContext(
{
public DbSet<Blob> Blobs { get; set; } = default!;
public DbSet<MetadataEntity> Metadata { get; set; } = default!;
public DbSet<MetadataVersionEntity> MetadataHistory { get; set; } = default!;
public DbSet<NoteEntity> Notes { get; set; } = default!;
public DbSet<NoteVersionEntity> NoteVersions { get; set; } = default!;
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<MetadataEntity>(options =>
{
options.HasKey(m => m.Id);
});
modelBuilder.Entity<MetadataVersionEntity>(options =>
{
options.Property(m => m.Id).IsRequired();
options.HasKey(m => m.Version);
options.HasIndex(nameof(MetadataVersionEntity.Id), nameof(MetadataVersionEntity.Version)).IsUnique();
});
modelBuilder.Entity<NoteEntity>(options =>
{
options.OwnsOne(m => m.Value);