fixes small bug in database logic wich blocked creating the database

This commit is contained in:
Henry Trumme
2025-04-22 01:18:35 +02:00
parent db59a9e26e
commit 1b40ea2cea
2 changed files with 12 additions and 9 deletions

View File

@@ -4,18 +4,11 @@ using Microsoft.EntityFrameworkCore;
namespace WatchLog.Data namespace WatchLog.Data
{ {
[PrimaryKey(nameof(SharedListId), nameof(GlobalEntityId))]
public class SharedListEntity public class SharedListEntity
{ {
// --- Foreign Keys --- [Key]
public int SharedListId { get; set; } public int Id { get; set; }
public int GlobalEntityId { get; set; }
// --- Weiterer Foreign Key ---
public int? SharedWatchStatusId { get; set; }
// --- Datenfelder für den Listeneintrag ---
public bool Favorite { get; set; } = false; public bool Favorite { get; set; } = false;
[MaxLength(1000)] [MaxLength(1000)]
@@ -31,6 +24,14 @@ namespace WatchLog.Data
public DateTime? LastChange { get; set; } public DateTime? LastChange { get; set; }
// --- Foreign Keys ---
public int SharedListId { get; set; }
public int GlobalEntityId { get; set; }
public int? SharedWatchStatusId { get; set; }
// --- Navigation Properties --- // --- Navigation Properties ---
[ForeignKey(nameof(SharedListId))] [ForeignKey(nameof(SharedListId))]
public virtual SharedList SharedList { get; set; } = null!; public virtual SharedList SharedList { get; set; } = null!;

View File

@@ -16,6 +16,8 @@ namespace WatchLog.Data
optionsBuilder.UseSqlite(Configuration.GetConnectionString("WatchLogDB")); optionsBuilder.UseSqlite(Configuration.GetConnectionString("WatchLogDB"));
} }
//Note: Link Tables a commented out because Entity Framework creates the tables by itself
// Global // Global
public DbSet<Admin> Admins { get; set; } public DbSet<Admin> Admins { get; set; }
public DbSet<Genre> Genres { get; set; } public DbSet<Genre> Genres { get; set; }