// using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using OpenArchival.DataAccess; #nullable disable namespace OpenArchival.DataAccess.Migrations { [DbContext(typeof(ApplicationDbContext))] [Migration("20250813011348_ChangedArtifactRelationships")] partial class ChangedArtifactRelationships { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "9.0.7") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("ArtifactEntryArtifactEntry", b => { b.Property("RelatedById") .HasColumnType("integer"); b.Property("RelatedToId") .HasColumnType("integer"); b.HasKey("RelatedById", "RelatedToId"); b.HasIndex("RelatedToId"); b.ToTable("ArtifactRelationships", (string)null); }); modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b => { b.Property("ArtifactEntriesId") .HasColumnType("integer"); b.Property("TagsId") .HasColumnType("integer"); b.HasKey("ArtifactEntriesId", "TagsId"); b.HasIndex("TagsId"); b.ToTable("ArtifactEntryArtifactEntryTag"); }); modelBuilder.Entity("OpenArchival.DataAccess.ArchiveCategory", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Description") .HasColumnType("text"); b.PrimitiveCollection>("FieldDescriptions") .IsRequired() .HasColumnType("text[]"); b.PrimitiveCollection>("FieldNames") .IsRequired() .HasColumnType("text[]"); b.Property("FieldSeparator") .IsRequired() .HasColumnType("text"); b.Property("Name") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.ToTable("ArchiveCategory"); }); modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Description") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.ToTable("ArtifactDefects"); }); modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("ArtifactNumber") .HasColumnType("text"); b.PrimitiveCollection>("AssociatedDates") .HasColumnType("timestamp with time zone[]"); b.PrimitiveCollection>("Defects") .HasColumnType("text[]"); b.Property("Description") .HasColumnType("text"); b.Property("FileTextContent") .HasColumnType("text"); b.Property("IsPubliclyVisible") .HasColumnType("boolean"); b.PrimitiveCollection>("Links") .HasColumnType("text[]"); b.PrimitiveCollection>("ListedNames") .HasColumnType("text[]"); b.Property("ParentArtifactGroupingId") .HasColumnType("integer"); b.Property("StorageLocationId") .HasColumnType("integer"); b.Property("Title") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("ParentArtifactGroupingId"); b.HasIndex("StorageLocationId"); b.ToTable("ArtifactEntries"); }); modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("ArtifactGroupingId") .HasColumnType("integer"); b.Property("Name") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("ArtifactGroupingId"); b.ToTable("ArtifactEntryTags"); }); modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CategoryId") .HasColumnType("integer"); b.Property("Description") .HasColumnType("text"); b.Property("IsPublicallyVisible") .HasColumnType("boolean"); b.Property("Title") .IsRequired() .HasColumnType("text"); b.Property("Type") .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("CategoryId"); b.ToTable("ArtifactGroupings"); }); modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Location") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.ToTable("ArtifactStorageLocations"); }); modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Name") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.ToTable("ArtifactTypes"); }); modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("OriginalName") .IsRequired() .HasColumnType("text"); b.Property("ParentArtifactEntryId") .HasColumnType("integer"); b.Property("Path") .IsRequired() .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("ParentArtifactEntryId"); b.ToTable("ArtifactFilePaths"); }); modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("FirstName") .IsRequired() .HasColumnType("text"); b.Property("LastName") .IsRequired() .HasColumnType("text"); b.Property("ParentArtifactEntryId") .HasColumnType("integer"); b.Property("Title") .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("ParentArtifactEntryId"); b.ToTable("ArtifactAssociatedNames"); }); modelBuilder.Entity("ArtifactEntryArtifactEntry", b => { b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null) .WithMany() .HasForeignKey("RelatedById") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null) .WithMany() .HasForeignKey("RelatedToId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b => { b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null) .WithMany() .HasForeignKey("ArtifactEntriesId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null) .WithMany() .HasForeignKey("TagsId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b => { b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ParentArtifactGrouping") .WithMany("ChildArtifactEntries") .HasForeignKey("ParentArtifactGroupingId"); b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation") .WithMany() .HasForeignKey("StorageLocationId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("ParentArtifactGrouping"); b.Navigation("StorageLocation"); }); modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b => { b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null) .WithMany("ChildTags") .HasForeignKey("ArtifactGroupingId"); }); modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b => { b.HasOne("OpenArchival.DataAccess.ArchiveCategory", "Category") .WithMany() .HasForeignKey("CategoryId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.OwnsOne("OpenArchival.DataAccess.IdentifierFields", "IdentifierFields", b1 => { b1.Property("ArtifactGroupingId") .HasColumnType("integer"); b1.PrimitiveCollection>("Values") .IsRequired() .HasColumnType("text[]"); b1.HasKey("ArtifactGroupingId"); b1.ToTable("ArtifactGroupings"); b1.ToJson("IdentifierFields"); b1.WithOwner() .HasForeignKey("ArtifactGroupingId"); }); b.Navigation("Category"); b.Navigation("IdentifierFields") .IsRequired(); }); modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b => { b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry") .WithMany("Files") .HasForeignKey("ParentArtifactEntryId"); b.Navigation("ParentArtifactEntry"); }); modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b => { b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry") .WithMany() .HasForeignKey("ParentArtifactEntryId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("ParentArtifactEntry"); }); modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b => { b.Navigation("Files"); }); modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b => { b.Navigation("ChildArtifactEntries"); b.Navigation("ChildTags"); }); #pragma warning restore 612, 618 } } }