database changes

This commit is contained in:
2024-11-08 22:19:34 +01:00
Unverified
parent ba5d56e17c
commit 046dc26915
20 changed files with 3135 additions and 60 deletions

View File

@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using WatchIt.Database.Model.Account;
namespace WatchIt.Database.Model.Configuration.Account;
public class AccountFollowConfiguration : IEntityTypeConfiguration<AccountFollow>
{
public void Configure(EntityTypeBuilder<AccountFollow> builder)
{
builder.HasKey(x => x.Id);
builder.HasIndex(x => x.Id)
.IsUnique();
builder.Property(x => x.Id)
.IsRequired();
builder.HasOne(x => x.AccountFollower)
.WithMany(x => x.AccountFollows)
.HasForeignKey(x => x.AccountFollowerId)
.IsRequired();
builder.Property(x => x.AccountFollowerId)
.IsRequired();
builder.HasOne(x => x.AccountFollowed)
.WithMany(x => x.AccountFollowedBy)
.HasForeignKey(x => x.AccountFollowedId)
.IsRequired();
builder.Property(x => x.AccountFollowedId)
.IsRequired();
}
}

View File

@@ -20,9 +20,6 @@ public class GenreConfiguration : IEntityTypeConfiguration<Genre>
.HasMaxLength(100)
.IsRequired();
builder.Property(x => x.Description)
.HasMaxLength(1000);
// Navigation
builder.HasMany(x => x.Media)
.WithMany(x => x.Genres)