From f150338f7a275bd7664f59a4365f163a17049bd0 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Thu, 17 Aug 2023 09:36:09 +1000 Subject: Update DB schema to fix implicit tags bug --- HBContext.cs | 5 +++++ Tag.cs | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/HBContext.cs b/HBContext.cs index 17b8b3d..162a2c7 100644 --- a/HBContext.cs +++ b/HBContext.cs @@ -1,5 +1,6 @@ using Microsoft.EntityFrameworkCore; using HyperBooru.Services; +using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage; namespace HyperBooru; @@ -37,5 +38,9 @@ public class HBContext : DbContext { new() { ObjectId = -1, Source = TagSource.Internal, Name = "nsfw" }, new() { ObjectId = -2, Source = TagSource.Internal, Name = "ingest" } }); + + modelBuilder.Entity() + .HasMany(e => e.ImplicitTags) + .WithMany(); } } \ No newline at end of file diff --git a/Tag.cs b/Tag.cs index 0f7fed2..810c49c 100644 --- a/Tag.cs +++ b/Tag.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace HyperBooru; @@ -9,10 +10,10 @@ public enum TagSource { } public class TagDefinition : HBObject { - public TagSource Source { get; set; } = TagSource.Internal; - public string? Namespace { get; set; } - public string Name { get; set; } - public virtual List ImplicitTags { get; set; } = new(); + public TagSource Source { get; set; } = TagSource.Internal; + public string? Namespace { get; set; } + public string Name { get; set; } + public virtual List ImplicitTags { get; set; } = new(); } public class Tag : HBObject { -- cgit v1.3