[DB] Update initial db

This commit is contained in:
max
2025-09-02 15:37:28 +02:00
parent dbf6938a7e
commit c30e503642
7 changed files with 125 additions and 48 deletions

View File

@@ -32,16 +32,21 @@ public sealed class LibraryDbContext : DbContext
{
channel.ToTable("channels");
channel.HasKey(x => x.Id);
//TODO: Link media from channel
channel.HasMany(x => x.Media)
.WithOne()
.HasForeignKey(x => x.ChannelId);
channel.HasMany(x => x.Playlists)
.WithOne()
.HasForeignKey(x => x.ChannelId);
channel.HasOne(x => x.ClientAccount)
.WithOne()
.HasForeignKey<ClientAccountEntity>(e => e.Id);
});
modelBuilder.Entity<ClientAccountEntity>(cae =>
{
cae.ToTable("client_accounts");
cae.HasKey(x => x.Id);
cae.HasMany(x => x.Playlists)
.WithOne()
.HasForeignKey(x => x.ChannelId);
cae.HasMany(x => x.HttpCookies)
.WithOne()
.HasForeignKey(x => x.ClientId);