From 0d758c6cd118641e86e6a7ddd7285be916cdb2d8 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Fri, 11 Aug 2023 14:41:40 +1000 Subject: Updated database schema to use separate tables --- Migrations/HyperBooruDbContextModelSnapshot.cs | 39 ++++++++++++++++++-------- 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'Migrations/HyperBooruDbContextModelSnapshot.cs') diff --git a/Migrations/HyperBooruDbContextModelSnapshot.cs b/Migrations/HyperBooruDbContextModelSnapshot.cs index 566b66c..36f6e72 100644 --- a/Migrations/HyperBooruDbContextModelSnapshot.cs +++ b/Migrations/HyperBooruDbContextModelSnapshot.cs @@ -27,10 +27,6 @@ namespace HyperBooru.Migrations .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); - b.Property("Discriminator") - .IsRequired() - .HasColumnType("TEXT"); - b.Property("Guid") .HasColumnType("TEXT"); @@ -41,11 +37,9 @@ namespace HyperBooru.Migrations b.HasIndex("Guid"); - b.ToTable("Objects"); - - b.HasDiscriminator("Discriminator").HasValue("DbObject"); + b.ToTable("Objects", (string)null); - b.UseTphMappingStrategy(); + b.UseTptMappingStrategy(); }); modelBuilder.Entity("HyperBooru.DbUploadedFile", b => @@ -80,7 +74,7 @@ namespace HyperBooru.Migrations b.HasIndex("MediaObjectId"); - b.ToTable("UploadedFiles"); + b.ToTable("UploadedFiles", (string)null); }); modelBuilder.Entity("HyperBooru.DbMedia", b => @@ -101,7 +95,7 @@ namespace HyperBooru.Migrations b.Property("ShortDescription") .HasColumnType("TEXT"); - b.HasDiscriminator().HasValue("DbMedia"); + b.ToTable("Media", (string)null); }); modelBuilder.Entity("HyperBooru.DbTag", b => @@ -121,7 +115,7 @@ namespace HyperBooru.Migrations b.HasIndex("TargetObjectId"); - b.HasDiscriminator().HasValue("DbTag"); + b.ToTable("Tags", (string)null); }); modelBuilder.Entity("HyperBooru.DbTagDefinition", b => @@ -143,7 +137,7 @@ namespace HyperBooru.Migrations b.HasIndex("DbTagDefinitionObjectId"); - b.HasDiscriminator().HasValue("DbTagDefinition"); + b.ToTable("TagDefinitions", (string)null); }); modelBuilder.Entity("HyperBooru.DbUploadedFile", b => @@ -157,8 +151,23 @@ namespace HyperBooru.Migrations b.Navigation("Media"); }); + modelBuilder.Entity("HyperBooru.DbMedia", b => + { + b.HasOne("HyperBooru.DbObject", null) + .WithOne() + .HasForeignKey("HyperBooru.DbMedia", "ObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("HyperBooru.DbTag", b => { + b.HasOne("HyperBooru.DbObject", null) + .WithOne() + .HasForeignKey("HyperBooru.DbTag", "ObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("HyperBooru.DbTagDefinition", "TagDefinition") .WithMany() .HasForeignKey("TagDefinitionObjectId") @@ -181,6 +190,12 @@ namespace HyperBooru.Migrations b.HasOne("HyperBooru.DbTagDefinition", null) .WithMany("ImplicitTags") .HasForeignKey("DbTagDefinitionObjectId"); + + b.HasOne("HyperBooru.DbObject", null) + .WithOne() + .HasForeignKey("HyperBooru.DbTagDefinition", "ObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("HyperBooru.DbObject", b => -- cgit v1.3