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/20230811002826_Initial.Designer.cs | 221 ++++++++++++++++++++++++++ 1 file changed, 221 insertions(+) create mode 100644 Migrations/20230811002826_Initial.Designer.cs (limited to 'Migrations/20230811002826_Initial.Designer.cs') diff --git a/Migrations/20230811002826_Initial.Designer.cs b/Migrations/20230811002826_Initial.Designer.cs new file mode 100644 index 0000000..9db9176 --- /dev/null +++ b/Migrations/20230811002826_Initial.Designer.cs @@ -0,0 +1,221 @@ +// +using System; +using HyperBooru; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace HyperBooru.Migrations +{ + [DbContext(typeof(HyperBooruDbContext))] + [Migration("20230811002826_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.10") + .HasAnnotation("Proxies:ChangeTracking", false) + .HasAnnotation("Proxies:CheckEquality", false) + .HasAnnotation("Proxies:LazyLoading", true); + + modelBuilder.Entity("HyperBooru.DbObject", b => + { + b.Property("ObjectId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Guid") + .HasColumnType("TEXT"); + + b.Property("ObjectType") + .HasColumnType("INTEGER"); + + b.HasKey("ObjectId"); + + b.HasIndex("Guid"); + + b.ToTable("Objects", (string)null); + + b.UseTptMappingStrategy(); + }); + + modelBuilder.Entity("HyperBooru.DbUploadedFile", b => + { + b.Property("UploadedFileId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("Filename") + .HasColumnType("TEXT"); + + b.Property("LastAccessTime") + .HasColumnType("TEXT"); + + b.Property("LastWriteTime") + .HasColumnType("TEXT"); + + b.Property("MediaObjectId") + .HasColumnType("INTEGER"); + + b.Property("OriginalChecksum") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UploadTime") + .HasColumnType("TEXT"); + + b.HasKey("UploadedFileId"); + + b.HasIndex("MediaObjectId"); + + b.ToTable("UploadedFiles", (string)null); + }); + + modelBuilder.Entity("HyperBooru.DbMedia", b => + { + b.HasBaseType("HyperBooru.DbObject"); + + b.Property("Checksum") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("LongDescription") + .HasColumnType("TEXT"); + + b.Property("MimeType") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ShortDescription") + .HasColumnType("TEXT"); + + b.ToTable("Media", (string)null); + }); + + modelBuilder.Entity("HyperBooru.DbTag", b => + { + b.HasBaseType("HyperBooru.DbObject"); + + b.Property("CreateTime") + .HasColumnType("TEXT"); + + b.Property("TagDefinitionObjectId") + .HasColumnType("INTEGER"); + + b.Property("TargetObjectId") + .HasColumnType("INTEGER"); + + b.HasIndex("TagDefinitionObjectId"); + + b.HasIndex("TargetObjectId"); + + b.ToTable("Tags", (string)null); + }); + + modelBuilder.Entity("HyperBooru.DbTagDefinition", b => + { + b.HasBaseType("HyperBooru.DbObject"); + + b.Property("DbTagDefinitionObjectId") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Namespace") + .HasColumnType("TEXT"); + + b.Property("Source") + .HasColumnType("INTEGER"); + + b.HasIndex("DbTagDefinitionObjectId"); + + b.ToTable("TagDefinitions", (string)null); + }); + + modelBuilder.Entity("HyperBooru.DbUploadedFile", b => + { + b.HasOne("HyperBooru.DbMedia", "Media") + .WithMany("UploadedFiles") + .HasForeignKey("MediaObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("HyperBooru.DbObject", "Target") + .WithMany("Tags") + .HasForeignKey("TargetObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TagDefinition"); + + b.Navigation("Target"); + }); + + modelBuilder.Entity("HyperBooru.DbTagDefinition", b => + { + 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 => + { + b.Navigation("Tags"); + }); + + modelBuilder.Entity("HyperBooru.DbMedia", b => + { + b.Navigation("UploadedFiles"); + }); + + modelBuilder.Entity("HyperBooru.DbTagDefinition", b => + { + b.Navigation("ImplicitTags"); + }); +#pragma warning restore 612, 618 + } + } +} -- cgit v1.3