Got fix working for issues editing

This commit is contained in:
Vincent Allen
2025-09-06 09:33:41 -04:00
parent 9a0661e985
commit fd0e6290fe
561 changed files with 15420 additions and 1067 deletions

View File

@@ -29,17 +29,24 @@ public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
/*
modelBuilder.Entity<ArtifactEntry>()
.HasMany(p => p.Files)
.WithOne(p => p.ParentArtifactEntry)
.IsRequired(false);
*/
// Make other associations
modelBuilder.Entity<ArtifactEntry>()
.HasMany(a => a.RelatedTo)
.WithMany(a => a.RelatedBy)
.UsingEntity(j => j.ToTable("ArtifactRelationships"));
modelBuilder.Entity<ArtifactEntry>()
.HasOne(a => a.StorageLocation)
.WithMany(l => l.ArtifactEntries);
modelBuilder.Entity<ArtifactGrouping>()
.OwnsOne(p => p.IdentifierFields)
.ToJson();

View File

@@ -0,0 +1,694 @@
// <auto-generated />
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("20250904163801_properlylinktags2")]
partial class properlylinktags2
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.Property<int>("RelatedById")
.HasColumnType("integer");
b.Property<int>("RelatedToId")
.HasColumnType("integer");
b.HasKey("RelatedById", "RelatedToId");
b.HasIndex("RelatedToId");
b.ToTable("ArtifactRelationships", (string)null);
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("TagsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "TagsId");
b.HasIndex("TagsId");
b.ToTable("ArtifactEntryArtifactEntryTag");
});
modelBuilder.Entity("ArtifactEntryListedName", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("ListedNamesId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "ListedNamesId");
b.HasIndex("ListedNamesId");
b.ToTable("ArtifactEntryListedName");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("ProviderKey")
.HasColumnType("text");
b.Property<string>("ProviderDisplayName")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("RoleId")
.HasColumnType("text");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PermissionLevel")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ArchiveCategory", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasColumnType("text");
b.PrimitiveCollection<List<string>>("FieldDescriptions")
.IsRequired()
.HasColumnType("text[]");
b.PrimitiveCollection<List<string>>("FieldNames")
.IsRequired()
.HasColumnType("text[]");
b.Property<string>("FieldSeparator")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArchiveCategories");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("ArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ArtifactEntryId");
b.ToTable("ArtifactDefects");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("ArtifactNumber")
.HasColumnType("text");
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
.HasColumnType("timestamp with time zone[]");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("FileTextContent")
.HasColumnType("text");
b.Property<bool>("IsPubliclyVisible")
.HasColumnType("boolean");
b.PrimitiveCollection<List<string>>("Links")
.HasColumnType("text[]");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("StorageLocationId");
b.HasIndex("TypeId");
b.ToTable("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactEntryTags");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CategoryId")
.HasColumnType("integer");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<bool>("IsPublicallyVisible")
.HasColumnType("boolean");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Type")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.ToTable("ArtifactGroupings");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Location")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactStorageLocations");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactTypes");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("OriginalName")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactFilePaths");
});
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
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("ArtifactEntryListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ListedName", null)
.WithMany()
.HasForeignKey("ListedNamesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany("Defects")
.HasForeignKey("ArtifactEntryId");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany()
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany("ArtifactEntries")
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ArtifactGrouping");
b.Navigation("StorageLocation");
b.Navigation("Type");
});
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<int>("ArtifactGroupingId")
.HasColumnType("integer");
b1.PrimitiveCollection<List<string>>("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.ArtifactEntry", b =>
{
b.Navigation("Defects");
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Navigation("ArtifactEntries");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,82 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class properlylinktags2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactAssociatedNames_ArtifactEntries_ParentArtifactEntry~",
table: "ArtifactAssociatedNames");
migrationBuilder.DropIndex(
name: "IX_ArtifactAssociatedNames_ParentArtifactEntryId",
table: "ArtifactAssociatedNames");
migrationBuilder.DropColumn(
name: "ParentArtifactEntryId",
table: "ArtifactAssociatedNames");
migrationBuilder.CreateTable(
name: "ArtifactEntryListedName",
columns: table => new
{
ArtifactEntriesId = table.Column<int>(type: "integer", nullable: false),
ListedNamesId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ArtifactEntryListedName", x => new { x.ArtifactEntriesId, x.ListedNamesId });
table.ForeignKey(
name: "FK_ArtifactEntryListedName_ArtifactAssociatedNames_ListedNames~",
column: x => x.ListedNamesId,
principalTable: "ArtifactAssociatedNames",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ArtifactEntryListedName_ArtifactEntries_ArtifactEntriesId",
column: x => x.ArtifactEntriesId,
principalTable: "ArtifactEntries",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ArtifactEntryListedName_ListedNamesId",
table: "ArtifactEntryListedName",
column: "ListedNamesId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ArtifactEntryListedName");
migrationBuilder.AddColumn<int>(
name: "ParentArtifactEntryId",
table: "ArtifactAssociatedNames",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateIndex(
name: "IX_ArtifactAssociatedNames_ParentArtifactEntryId",
table: "ArtifactAssociatedNames",
column: "ParentArtifactEntryId");
migrationBuilder.AddForeignKey(
name: "FK_ArtifactAssociatedNames_ArtifactEntries_ParentArtifactEntry~",
table: "ArtifactAssociatedNames",
column: "ParentArtifactEntryId",
principalTable: "ArtifactEntries",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@@ -0,0 +1,710 @@
// <auto-generated />
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("20250904164613_properlylinktags3")]
partial class properlylinktags3
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("DefectsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "DefectsId");
b.HasIndex("DefectsId");
b.ToTable("ArtifactDefectArtifactEntry");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.Property<int>("RelatedById")
.HasColumnType("integer");
b.Property<int>("RelatedToId")
.HasColumnType("integer");
b.HasKey("RelatedById", "RelatedToId");
b.HasIndex("RelatedToId");
b.ToTable("ArtifactRelationships", (string)null);
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("TagsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "TagsId");
b.HasIndex("TagsId");
b.ToTable("ArtifactEntryArtifactEntryTag");
});
modelBuilder.Entity("ArtifactEntryListedName", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("ListedNamesId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "ListedNamesId");
b.HasIndex("ListedNamesId");
b.ToTable("ArtifactEntryListedName");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("ProviderKey")
.HasColumnType("text");
b.Property<string>("ProviderDisplayName")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("RoleId")
.HasColumnType("text");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PermissionLevel")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ArchiveCategory", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasColumnType("text");
b.PrimitiveCollection<List<string>>("FieldDescriptions")
.IsRequired()
.HasColumnType("text[]");
b.PrimitiveCollection<List<string>>("FieldNames")
.IsRequired()
.HasColumnType("text[]");
b.Property<string>("FieldSeparator")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArchiveCategories");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactDefects");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("ArtifactNumber")
.HasColumnType("text");
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
.HasColumnType("timestamp with time zone[]");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("FileTextContent")
.HasColumnType("text");
b.Property<bool>("IsPubliclyVisible")
.HasColumnType("boolean");
b.PrimitiveCollection<List<string>>("Links")
.HasColumnType("text[]");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("StorageLocationId");
b.HasIndex("TypeId");
b.ToTable("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactEntryTags");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CategoryId")
.HasColumnType("integer");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<bool>("IsPublicallyVisible")
.HasColumnType("boolean");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Type")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.ToTable("ArtifactGroupings");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Location")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactStorageLocations");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactTypes");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("OriginalName")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactFilePaths");
});
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactDefect", null)
.WithMany()
.HasForeignKey("DefectsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
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("ArtifactEntryListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ListedName", null)
.WithMany()
.HasForeignKey("ListedNamesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany()
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany("ArtifactEntries")
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ArtifactGrouping");
b.Navigation("StorageLocation");
b.Navigation("Type");
});
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<int>("ArtifactGroupingId")
.HasColumnType("integer");
b1.PrimitiveCollection<List<string>>("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.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Navigation("ArtifactEntries");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,80 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class properlylinktags3 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactDefects_ArtifactEntries_ArtifactEntryId",
table: "ArtifactDefects");
migrationBuilder.DropIndex(
name: "IX_ArtifactDefects_ArtifactEntryId",
table: "ArtifactDefects");
migrationBuilder.DropColumn(
name: "ArtifactEntryId",
table: "ArtifactDefects");
migrationBuilder.CreateTable(
name: "ArtifactDefectArtifactEntry",
columns: table => new
{
ArtifactEntriesId = table.Column<int>(type: "integer", nullable: false),
DefectsId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ArtifactDefectArtifactEntry", x => new { x.ArtifactEntriesId, x.DefectsId });
table.ForeignKey(
name: "FK_ArtifactDefectArtifactEntry_ArtifactDefects_DefectsId",
column: x => x.DefectsId,
principalTable: "ArtifactDefects",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ArtifactDefectArtifactEntry_ArtifactEntries_ArtifactEntries~",
column: x => x.ArtifactEntriesId,
principalTable: "ArtifactEntries",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ArtifactDefectArtifactEntry_DefectsId",
table: "ArtifactDefectArtifactEntry",
column: "DefectsId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ArtifactDefectArtifactEntry");
migrationBuilder.AddColumn<int>(
name: "ArtifactEntryId",
table: "ArtifactDefects",
type: "integer",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_ArtifactDefects_ArtifactEntryId",
table: "ArtifactDefects",
column: "ArtifactEntryId");
migrationBuilder.AddForeignKey(
name: "FK_ArtifactDefects_ArtifactEntries_ArtifactEntryId",
table: "ArtifactDefects",
column: "ArtifactEntryId",
principalTable: "ArtifactEntries",
principalColumn: "Id");
}
}
}

View File

@@ -0,0 +1,715 @@
// <auto-generated />
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("20250904165301_properlylinktags4")]
partial class properlylinktags4
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("DefectsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "DefectsId");
b.HasIndex("DefectsId");
b.ToTable("ArtifactDefectArtifactEntry");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.Property<int>("RelatedById")
.HasColumnType("integer");
b.Property<int>("RelatedToId")
.HasColumnType("integer");
b.HasKey("RelatedById", "RelatedToId");
b.HasIndex("RelatedToId");
b.ToTable("ArtifactRelationships", (string)null);
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("TagsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "TagsId");
b.HasIndex("TagsId");
b.ToTable("ArtifactEntryArtifactEntryTag");
});
modelBuilder.Entity("ArtifactEntryListedName", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("ListedNamesId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "ListedNamesId");
b.HasIndex("ListedNamesId");
b.ToTable("ArtifactEntryListedName");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("ProviderKey")
.HasColumnType("text");
b.Property<string>("ProviderDisplayName")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("RoleId")
.HasColumnType("text");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PermissionLevel")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ArchiveCategory", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasColumnType("text");
b.PrimitiveCollection<List<string>>("FieldDescriptions")
.IsRequired()
.HasColumnType("text[]");
b.PrimitiveCollection<List<string>>("FieldNames")
.IsRequired()
.HasColumnType("text[]");
b.Property<string>("FieldSeparator")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArchiveCategories");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactDefects");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("ArtifactNumber")
.HasColumnType("text");
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
.HasColumnType("timestamp with time zone[]");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("FileTextContent")
.HasColumnType("text");
b.Property<bool>("IsPubliclyVisible")
.HasColumnType("boolean");
b.PrimitiveCollection<List<string>>("Links")
.HasColumnType("text[]");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("StorageLocationId");
b.HasIndex("TypeId");
b.ToTable("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactEntryTags");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CategoryId")
.HasColumnType("integer");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<bool>("IsPublicallyVisible")
.HasColumnType("boolean");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Type")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.ToTable("ArtifactGroupings");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Location")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactStorageLocations");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactTypes");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("OriginalName")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactFilePaths");
});
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactDefect", null)
.WithMany()
.HasForeignKey("DefectsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
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("ArtifactEntryListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ListedName", null)
.WithMany()
.HasForeignKey("ListedNamesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany("ArtifactEntries")
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany("ArtifactEntries")
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ArtifactGrouping");
b.Navigation("StorageLocation");
b.Navigation("Type");
});
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<int>("ArtifactGroupingId")
.HasColumnType("integer");
b1.PrimitiveCollection<List<string>>("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.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Navigation("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Navigation("ArtifactEntries");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class properlylinktags4 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@@ -0,0 +1,715 @@
// <auto-generated />
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("20250904175259_relationshipsfixed")]
partial class relationshipsfixed
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("DefectsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "DefectsId");
b.HasIndex("DefectsId");
b.ToTable("ArtifactDefectArtifactEntry");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.Property<int>("RelatedById")
.HasColumnType("integer");
b.Property<int>("RelatedToId")
.HasColumnType("integer");
b.HasKey("RelatedById", "RelatedToId");
b.HasIndex("RelatedToId");
b.ToTable("ArtifactRelationships", (string)null);
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("TagsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "TagsId");
b.HasIndex("TagsId");
b.ToTable("ArtifactEntryArtifactEntryTag");
});
modelBuilder.Entity("ArtifactEntryListedName", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("ListedNamesId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "ListedNamesId");
b.HasIndex("ListedNamesId");
b.ToTable("ArtifactEntryListedName");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("ProviderKey")
.HasColumnType("text");
b.Property<string>("ProviderDisplayName")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("RoleId")
.HasColumnType("text");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PermissionLevel")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ArchiveCategory", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasColumnType("text");
b.PrimitiveCollection<List<string>>("FieldDescriptions")
.IsRequired()
.HasColumnType("text[]");
b.PrimitiveCollection<List<string>>("FieldNames")
.IsRequired()
.HasColumnType("text[]");
b.Property<string>("FieldSeparator")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArchiveCategories");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactDefects");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("ArtifactNumber")
.HasColumnType("text");
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
.HasColumnType("timestamp with time zone[]");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("FileTextContent")
.HasColumnType("text");
b.Property<bool>("IsPubliclyVisible")
.HasColumnType("boolean");
b.PrimitiveCollection<List<string>>("Links")
.HasColumnType("text[]");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("StorageLocationId");
b.HasIndex("TypeId");
b.ToTable("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactEntryTags");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CategoryId")
.HasColumnType("integer");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<bool>("IsPublicallyVisible")
.HasColumnType("boolean");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Type")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.ToTable("ArtifactGroupings");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Location")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactStorageLocations");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactTypes");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("OriginalName")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactFilePaths");
});
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactDefect", null)
.WithMany()
.HasForeignKey("DefectsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
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("ArtifactEntryListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ListedName", null)
.WithMany()
.HasForeignKey("ListedNamesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany("ArtifactEntries")
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany("ArtifactEntries")
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ArtifactGrouping");
b.Navigation("StorageLocation");
b.Navigation("Type");
});
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<int>("ArtifactGroupingId")
.HasColumnType("integer");
b1.PrimitiveCollection<List<string>>("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.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Navigation("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Navigation("ArtifactEntries");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class relationshipsfixed : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@@ -0,0 +1,725 @@
// <auto-generated />
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("20250904184314_Changed")]
partial class Changed
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("DefectsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "DefectsId");
b.HasIndex("DefectsId");
b.ToTable("ArtifactDefectArtifactEntry");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.Property<int>("RelatedById")
.HasColumnType("integer");
b.Property<int>("RelatedToId")
.HasColumnType("integer");
b.HasKey("RelatedById", "RelatedToId");
b.HasIndex("RelatedToId");
b.ToTable("ArtifactRelationships", (string)null);
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("TagsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "TagsId");
b.HasIndex("TagsId");
b.ToTable("ArtifactEntryArtifactEntryTag");
});
modelBuilder.Entity("ArtifactEntryListedName", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("ListedNamesId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "ListedNamesId");
b.HasIndex("ListedNamesId");
b.ToTable("ArtifactEntryListedName");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("ProviderKey")
.HasColumnType("text");
b.Property<string>("ProviderDisplayName")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("RoleId")
.HasColumnType("text");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PermissionLevel")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ArchiveCategory", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasColumnType("text");
b.PrimitiveCollection<List<string>>("FieldDescriptions")
.IsRequired()
.HasColumnType("text[]");
b.PrimitiveCollection<List<string>>("FieldNames")
.IsRequired()
.HasColumnType("text[]");
b.Property<string>("FieldSeparator")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArchiveCategories");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactDefects");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("ArtifactNumber")
.HasColumnType("text");
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
.HasColumnType("timestamp with time zone[]");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("FileTextContent")
.HasColumnType("text");
b.Property<bool>("IsPubliclyVisible")
.HasColumnType("boolean");
b.PrimitiveCollection<List<string>>("Links")
.HasColumnType("text[]");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("StorageLocationId");
b.HasIndex("TypeId");
b.ToTable("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactEntryTags");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CategoryId")
.HasColumnType("integer");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<bool>("IsPublicallyVisible")
.HasColumnType("boolean");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.HasIndex("TypeId");
b.ToTable("ArtifactGroupings");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Location")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactStorageLocations");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactTypes");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("OriginalName")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactFilePaths");
});
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactDefect", null)
.WithMany()
.HasForeignKey("DefectsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
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("ArtifactEntryListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ListedName", null)
.WithMany()
.HasForeignKey("ListedNamesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany("ArtifactEntries")
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany("ArtifactEntries")
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ArtifactGrouping");
b.Navigation("StorageLocation");
b.Navigation("Type");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.HasOne("OpenArchival.DataAccess.ArchiveCategory", "Category")
.WithMany()
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany()
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("OpenArchival.DataAccess.IdentifierFields", "IdentifierFields", b1 =>
{
b1.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b1.PrimitiveCollection<List<string>>("Values")
.IsRequired()
.HasColumnType("text[]");
b1.HasKey("ArtifactGroupingId");
b1.ToTable("ArtifactGroupings");
b1.ToJson("IdentifierFields");
b1.WithOwner()
.HasForeignKey("ArtifactGroupingId");
});
b.Navigation("Category");
b.Navigation("IdentifierFields")
.IsRequired();
b.Navigation("Type");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany("Files")
.HasForeignKey("ParentArtifactEntryId");
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Navigation("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Navigation("ArtifactEntries");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,60 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Changed : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Type",
table: "ArtifactGroupings");
migrationBuilder.AddColumn<int>(
name: "TypeId",
table: "ArtifactGroupings",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateIndex(
name: "IX_ArtifactGroupings_TypeId",
table: "ArtifactGroupings",
column: "TypeId");
migrationBuilder.AddForeignKey(
name: "FK_ArtifactGroupings_ArtifactTypes_TypeId",
table: "ArtifactGroupings",
column: "TypeId",
principalTable: "ArtifactTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactGroupings_ArtifactTypes_TypeId",
table: "ArtifactGroupings");
migrationBuilder.DropIndex(
name: "IX_ArtifactGroupings_TypeId",
table: "ArtifactGroupings");
migrationBuilder.DropColumn(
name: "TypeId",
table: "ArtifactGroupings");
migrationBuilder.AddColumn<string>(
name: "Type",
table: "ArtifactGroupings",
type: "text",
nullable: true);
}
}
}

View File

@@ -0,0 +1,723 @@
// <auto-generated />
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("20250904185839_noparentforfiles")]
partial class noparentforfiles
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("DefectsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "DefectsId");
b.HasIndex("DefectsId");
b.ToTable("ArtifactDefectArtifactEntry");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.Property<int>("RelatedById")
.HasColumnType("integer");
b.Property<int>("RelatedToId")
.HasColumnType("integer");
b.HasKey("RelatedById", "RelatedToId");
b.HasIndex("RelatedToId");
b.ToTable("ArtifactRelationships", (string)null);
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("TagsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "TagsId");
b.HasIndex("TagsId");
b.ToTable("ArtifactEntryArtifactEntryTag");
});
modelBuilder.Entity("ArtifactEntryListedName", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("ListedNamesId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "ListedNamesId");
b.HasIndex("ListedNamesId");
b.ToTable("ArtifactEntryListedName");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("ProviderKey")
.HasColumnType("text");
b.Property<string>("ProviderDisplayName")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("RoleId")
.HasColumnType("text");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PermissionLevel")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ArchiveCategory", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasColumnType("text");
b.PrimitiveCollection<List<string>>("FieldDescriptions")
.IsRequired()
.HasColumnType("text[]");
b.PrimitiveCollection<List<string>>("FieldNames")
.IsRequired()
.HasColumnType("text[]");
b.Property<string>("FieldSeparator")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArchiveCategories");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactDefects");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("ArtifactNumber")
.HasColumnType("text");
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
.HasColumnType("timestamp with time zone[]");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("FileTextContent")
.HasColumnType("text");
b.Property<bool>("IsPubliclyVisible")
.HasColumnType("boolean");
b.PrimitiveCollection<List<string>>("Links")
.HasColumnType("text[]");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("StorageLocationId");
b.HasIndex("TypeId");
b.ToTable("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactEntryTags");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CategoryId")
.HasColumnType("integer");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<bool>("IsPublicallyVisible")
.HasColumnType("boolean");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.HasIndex("TypeId");
b.ToTable("ArtifactGroupings");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Location")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactStorageLocations");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactTypes");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("ArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("OriginalName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ArtifactEntryId");
b.ToTable("ArtifactFilePaths");
});
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactDefect", null)
.WithMany()
.HasForeignKey("DefectsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
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("ArtifactEntryListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ListedName", null)
.WithMany()
.HasForeignKey("ListedNamesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany("ArtifactEntries")
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany("ArtifactEntries")
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ArtifactGrouping");
b.Navigation("StorageLocation");
b.Navigation("Type");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.HasOne("OpenArchival.DataAccess.ArchiveCategory", "Category")
.WithMany()
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany()
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("OpenArchival.DataAccess.IdentifierFields", "IdentifierFields", b1 =>
{
b1.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b1.PrimitiveCollection<List<string>>("Values")
.IsRequired()
.HasColumnType("text[]");
b1.HasKey("ArtifactGroupingId");
b1.ToTable("ArtifactGroupings");
b1.ToJson("IdentifierFields");
b1.WithOwner()
.HasForeignKey("ArtifactGroupingId");
});
b.Navigation("Category");
b.Navigation("IdentifierFields")
.IsRequired();
b.Navigation("Type");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany("Files")
.HasForeignKey("ArtifactEntryId");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Navigation("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Navigation("ArtifactEntries");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,60 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class noparentforfiles : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactFilePaths_ArtifactEntries_ParentArtifactEntryId",
table: "ArtifactFilePaths");
migrationBuilder.RenameColumn(
name: "ParentArtifactEntryId",
table: "ArtifactFilePaths",
newName: "ArtifactEntryId");
migrationBuilder.RenameIndex(
name: "IX_ArtifactFilePaths_ParentArtifactEntryId",
table: "ArtifactFilePaths",
newName: "IX_ArtifactFilePaths_ArtifactEntryId");
migrationBuilder.AddForeignKey(
name: "FK_ArtifactFilePaths_ArtifactEntries_ArtifactEntryId",
table: "ArtifactFilePaths",
column: "ArtifactEntryId",
principalTable: "ArtifactEntries",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactFilePaths_ArtifactEntries_ArtifactEntryId",
table: "ArtifactFilePaths");
migrationBuilder.RenameColumn(
name: "ArtifactEntryId",
table: "ArtifactFilePaths",
newName: "ParentArtifactEntryId");
migrationBuilder.RenameIndex(
name: "IX_ArtifactFilePaths_ArtifactEntryId",
table: "ArtifactFilePaths",
newName: "IX_ArtifactFilePaths_ParentArtifactEntryId");
migrationBuilder.AddForeignKey(
name: "FK_ArtifactFilePaths_ArtifactEntries_ParentArtifactEntryId",
table: "ArtifactFilePaths",
column: "ParentArtifactEntryId",
principalTable: "ArtifactEntries",
principalColumn: "Id");
}
}
}

View File

@@ -0,0 +1,725 @@
// <auto-generated />
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("20250904190834_addbackparent")]
partial class addbackparent
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("DefectsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "DefectsId");
b.HasIndex("DefectsId");
b.ToTable("ArtifactDefectArtifactEntry");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.Property<int>("RelatedById")
.HasColumnType("integer");
b.Property<int>("RelatedToId")
.HasColumnType("integer");
b.HasKey("RelatedById", "RelatedToId");
b.HasIndex("RelatedToId");
b.ToTable("ArtifactRelationships", (string)null);
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("TagsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "TagsId");
b.HasIndex("TagsId");
b.ToTable("ArtifactEntryArtifactEntryTag");
});
modelBuilder.Entity("ArtifactEntryListedName", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("ListedNamesId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "ListedNamesId");
b.HasIndex("ListedNamesId");
b.ToTable("ArtifactEntryListedName");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("ProviderKey")
.HasColumnType("text");
b.Property<string>("ProviderDisplayName")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("RoleId")
.HasColumnType("text");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PermissionLevel")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ArchiveCategory", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasColumnType("text");
b.PrimitiveCollection<List<string>>("FieldDescriptions")
.IsRequired()
.HasColumnType("text[]");
b.PrimitiveCollection<List<string>>("FieldNames")
.IsRequired()
.HasColumnType("text[]");
b.Property<string>("FieldSeparator")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArchiveCategories");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactDefects");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("ArtifactNumber")
.HasColumnType("text");
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
.HasColumnType("timestamp with time zone[]");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("FileTextContent")
.HasColumnType("text");
b.Property<bool>("IsPubliclyVisible")
.HasColumnType("boolean");
b.PrimitiveCollection<List<string>>("Links")
.HasColumnType("text[]");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("StorageLocationId");
b.HasIndex("TypeId");
b.ToTable("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactEntryTags");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CategoryId")
.HasColumnType("integer");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<bool>("IsPublicallyVisible")
.HasColumnType("boolean");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.HasIndex("TypeId");
b.ToTable("ArtifactGroupings");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Location")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactStorageLocations");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactTypes");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("OriginalName")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactFilePaths");
});
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactDefect", null)
.WithMany()
.HasForeignKey("DefectsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
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("ArtifactEntryListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ListedName", null)
.WithMany()
.HasForeignKey("ListedNamesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany("ArtifactEntries")
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany("ArtifactEntries")
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ArtifactGrouping");
b.Navigation("StorageLocation");
b.Navigation("Type");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.HasOne("OpenArchival.DataAccess.ArchiveCategory", "Category")
.WithMany()
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany()
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("OpenArchival.DataAccess.IdentifierFields", "IdentifierFields", b1 =>
{
b1.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b1.PrimitiveCollection<List<string>>("Values")
.IsRequired()
.HasColumnType("text[]");
b1.HasKey("ArtifactGroupingId");
b1.ToTable("ArtifactGroupings");
b1.ToJson("IdentifierFields");
b1.WithOwner()
.HasForeignKey("ArtifactGroupingId");
});
b.Navigation("Category");
b.Navigation("IdentifierFields")
.IsRequired();
b.Navigation("Type");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany("Files")
.HasForeignKey("ParentArtifactEntryId");
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Navigation("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Navigation("ArtifactEntries");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,60 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class addbackparent : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactFilePaths_ArtifactEntries_ArtifactEntryId",
table: "ArtifactFilePaths");
migrationBuilder.RenameColumn(
name: "ArtifactEntryId",
table: "ArtifactFilePaths",
newName: "ParentArtifactEntryId");
migrationBuilder.RenameIndex(
name: "IX_ArtifactFilePaths_ArtifactEntryId",
table: "ArtifactFilePaths",
newName: "IX_ArtifactFilePaths_ParentArtifactEntryId");
migrationBuilder.AddForeignKey(
name: "FK_ArtifactFilePaths_ArtifactEntries_ParentArtifactEntryId",
table: "ArtifactFilePaths",
column: "ParentArtifactEntryId",
principalTable: "ArtifactEntries",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactFilePaths_ArtifactEntries_ParentArtifactEntryId",
table: "ArtifactFilePaths");
migrationBuilder.RenameColumn(
name: "ParentArtifactEntryId",
table: "ArtifactFilePaths",
newName: "ArtifactEntryId");
migrationBuilder.RenameIndex(
name: "IX_ArtifactFilePaths_ParentArtifactEntryId",
table: "ArtifactFilePaths",
newName: "IX_ArtifactFilePaths_ArtifactEntryId");
migrationBuilder.AddForeignKey(
name: "FK_ArtifactFilePaths_ArtifactEntries_ArtifactEntryId",
table: "ArtifactFilePaths",
column: "ArtifactEntryId",
principalTable: "ArtifactEntries",
principalColumn: "Id");
}
}
}

View File

@@ -23,6 +23,21 @@ namespace OpenArchival.DataAccess.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("DefectsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "DefectsId");
b.HasIndex("DefectsId");
b.ToTable("ArtifactDefectArtifactEntry");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.Property<int>("RelatedById")
@@ -53,6 +68,21 @@ namespace OpenArchival.DataAccess.Migrations
b.ToTable("ArtifactEntryArtifactEntryTag");
});
modelBuilder.Entity("ArtifactEntryListedName", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("ListedNamesId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "ListedNamesId");
b.HasIndex("ListedNamesId");
b.ToTable("ArtifactEntryListedName");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
@@ -293,17 +323,12 @@ namespace OpenArchival.DataAccess.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("ArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ArtifactEntryId");
b.ToTable("ArtifactDefects");
});
@@ -395,13 +420,15 @@ namespace OpenArchival.DataAccess.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<string>("Type")
.HasColumnType("text");
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.HasIndex("TypeId");
b.ToTable("ArtifactGroupings");
});
@@ -473,20 +500,30 @@ namespace OpenArchival.DataAccess.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactDefect", null)
.WithMany()
.HasForeignKey("DefectsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
@@ -517,6 +554,21 @@ namespace OpenArchival.DataAccess.Migrations
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ListedName", null)
.WithMany()
.HasForeignKey("ListedNamesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
@@ -568,13 +620,6 @@ namespace OpenArchival.DataAccess.Migrations
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany("Defects")
.HasForeignKey("ArtifactEntryId");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ArtifactGrouping")
@@ -584,13 +629,13 @@ namespace OpenArchival.DataAccess.Migrations
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany()
.WithMany("ArtifactEntries")
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany()
.WithMany("ArtifactEntries")
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@@ -610,6 +655,12 @@ namespace OpenArchival.DataAccess.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany()
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("OpenArchival.DataAccess.IdentifierFields", "IdentifierFields", b1 =>
{
b1.Property<int>("ArtifactGroupingId")
@@ -633,6 +684,8 @@ namespace OpenArchival.DataAccess.Migrations
b.Navigation("IdentifierFields")
.IsRequired();
b.Navigation("Type");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
@@ -644,30 +697,25 @@ namespace OpenArchival.DataAccess.Migrations
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany("ListedNames")
.HasForeignKey("ParentArtifactEntryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Defects");
b.Navigation("Files");
b.Navigation("ListedNames");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Navigation("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Navigation("ArtifactEntries");
});
#pragma warning restore 612, 618
}
}

View File

@@ -14,6 +14,7 @@ public class ArtifactDefect
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Index(IsUnique = true)]
public required string Description { get; set; }
public List<ArtifactEntry> ArtifactEntries { get; set; } = [];
}

View File

@@ -32,7 +32,9 @@ public class ArtifactEntry
public required ArtifactStorageLocation StorageLocation { get; set; }
public List<ArtifactEntryTag>? Tags { get; set; } = [];
//public List<ArtifactEntryTag>? Tags { get; set; } = [];
public List<ArtifactEntryTag> Tags { get; set; } = [];
public List<ListedName>? ListedNames { get; set; } = [];

View File

@@ -17,5 +17,5 @@ public class ArtifactEntryTag
[Index(IsUnique = true)]
public required string Name { get; set; }
public List<ArtifactEntry>? ArtifactEntries { get; set; } = [];
public List<ArtifactEntry> ArtifactEntries { get; set; } = [];
}

View File

@@ -40,7 +40,7 @@ public class ArtifactGrouping
public string? Description { get; set; }
public string? Type { get; set; }
public ArtifactType Type { get; set; }
public bool IsPublicallyVisible { get; set; }

View File

@@ -11,4 +11,6 @@ public class ArtifactStorageLocation
[System.ComponentModel.DataAnnotations.Schema.Index(IsUnique =true)]
public required string Location { get; set; }
public List<ArtifactEntry> ArtifactEntries { get; set; } = [];
}

View File

@@ -11,4 +11,6 @@ public class ArtifactType
[System.ComponentModel.DataAnnotations.Schema.Index(IsUnique =true)]
public required string Name { get; set; }
public List<ArtifactEntry>? ArtifactEntries { get; set; } = [];
}

View File

@@ -9,7 +9,7 @@ public class ListedName
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public required ArtifactEntry ParentArtifactEntry { get; set; }
public required string Value { get; set; }
public List<ArtifactEntry> ArtifactEntries { get; set; } = [];
}

View File

@@ -22,12 +22,19 @@ public class ArtifactGroupingProvider : IArtifactGroupingProvider
return await context.ArtifactGroupings
.Include(g => g.Category)
.Include(g => g.IdentifierFields)
.Include(g => g.Type)
.Include(g => g.ChildArtifactEntries)
.ThenInclude(e => e.StorageLocation)
.Include(g => g.ChildArtifactEntries)
.ThenInclude(e => e.Type)
.Include(g => g.ChildArtifactEntries)
.ThenInclude(e => e.Files)
.Include(g=> g.ChildArtifactEntries)
.ThenInclude(e => e.Tags)
.Include(g => g.ChildArtifactEntries)
.ThenInclude(e => e.ListedNames)
.Include(g => g.ChildArtifactEntries)
.ThenInclude(e => e.Defects)
.Where(g => g.Id == id)
.FirstOrDefaultAsync();
}
@@ -38,12 +45,19 @@ public class ArtifactGroupingProvider : IArtifactGroupingProvider
return await context.ArtifactGroupings
.Include(g => g.Category)
.Include(g => g.IdentifierFields)
.Include(g => g.Type)
.Include(g => g.ChildArtifactEntries)
.ThenInclude(e => e.StorageLocation)
.Include(g => g.ChildArtifactEntries)
.ThenInclude(e => e.Type)
.Include(g => g.ChildArtifactEntries)
.ThenInclude(e => e.Files)
.Include(g=> g.ChildArtifactEntries)
.ThenInclude(e => e.Tags)
.Include(g => g.ChildArtifactEntries)
.ThenInclude(e => e.ListedNames)
.Include(g => g.ChildArtifactEntries)
.ThenInclude(e => e.Defects)
.Where(g => g.ArtifactGroupingIdentifier == artifactGroupingIdentifier)
.FirstOrDefaultAsync();
}
@@ -51,6 +65,35 @@ public class ArtifactGroupingProvider : IArtifactGroupingProvider
public async Task CreateGroupingAsync(ArtifactGrouping grouping)
{
await using var context = await _context.CreateDbContextAsync();
// Iterate through all child entries and their file paths.
foreach (var entry in grouping.ChildArtifactEntries)
{
// Create a temporary list to hold the managed file path entities.
var managedFilePaths = new List<FilePathListing>();
// Handle each file path in the entry.
foreach (var filepath in entry.Files)
{
// Attempt to find the file path in the database.
var existingFilePath = await context.ArtifactFilePaths.FirstOrDefaultAsync(f => f.Path == filepath.Path);
if (existingFilePath != null)
{
// The file path already exists. Use the tracked instance.
managedFilePaths.Add(existingFilePath);
}
else
{
// The file path is new. Add it to the managed list.
managedFilePaths.Add(filepath);
}
}
// Replace the disconnected file path objects on the entry with the managed ones.
entry.Files = managedFilePaths;
}
context.ArtifactGroupings.Add(grouping);
await context.SaveChangesAsync();
}
@@ -58,7 +101,83 @@ public class ArtifactGroupingProvider : IArtifactGroupingProvider
public async Task UpdateGroupingAsync(ArtifactGrouping grouping)
{
await using var context = await _context.CreateDbContextAsync();
context.ArtifactGroupings.Update(grouping);
// **NEW LOGIC**
// Fetch the existing, tracked entity and its entire graph.
var existingGrouping = await context.ArtifactGroupings
.Include(g => g.Category)
.Include(g => g.Type)
.Include(g => g.IdentifierFields)
.Include(g => g.ChildArtifactEntries)
.ThenInclude(e => e.StorageLocation)
.Include(g => g.ChildArtifactEntries)
.ThenInclude(e => e.Files)
.Include(g => g.ChildArtifactEntries)
.ThenInclude(e => e.Tags)
.Include(g => g.ChildArtifactEntries)
.ThenInclude(e => e.ListedNames)
.Include(g => g.ChildArtifactEntries)
.ThenInclude(e => e.Defects)
.FirstOrDefaultAsync(g => g.Id == grouping.Id);
if (existingGrouping == null)
{
throw new InvalidOperationException($"Grouping with ID {grouping.Id} not found for update.");
}
// Update top-level properties.
existingGrouping.Title = grouping.Title;
existingGrouping.IsPublicallyVisible = grouping.IsPublicallyVisible;
existingGrouping.Description = grouping.Description;
// Manually manage collections to sync the in-memory graph.
var entriesInModel = grouping.ChildArtifactEntries.ToDictionary(e => e.Id);
// Remove entries from the database that are no longer in the model.
existingGrouping.ChildArtifactEntries.RemoveAll(e => !entriesInModel.ContainsKey(e.Id));
// Add or update existing entries.
foreach (var entryInModel in grouping.ChildArtifactEntries)
{
var existingEntry = existingGrouping.ChildArtifactEntries.FirstOrDefault(e => e.Id == entryInModel.Id);
if (existingEntry != null)
{
// Update an EXISTING entry.
existingEntry.Title = entryInModel.Title;
// Sync the files collection.
var filesInModel = entryInModel.Files.Select(f => f.Path).ToHashSet();
existingEntry.Files.RemoveAll(f => !filesInModel.Contains(f.Path));
var newFilesToRelate = filesInModel.Except(existingEntry.Files.Select(f => f.Path));
foreach (var filePath in newFilesToRelate)
{
var fileToAdd = await context.ArtifactFilePaths.FirstOrDefaultAsync(f => f.Path == filePath);
if (fileToAdd != null)
{
existingEntry.Files.Add(fileToAdd);
}
}
}
else
{
// Add a NEW entry to the existing grouping.
var newEntry = entryInModel;
// For this new entry, handle the file path relationships.
var existingFiles = await context.ArtifactFilePaths
.Where(fp => newEntry.Files.Select(f => f.Path).Contains(fp.Path))
.ToListAsync();
newEntry.Files.Clear();
foreach (var existingFile in existingFiles)
{
newEntry.Files.Add(existingFile);
}
existingGrouping.ChildArtifactEntries.Add(newEntry);
}
}
await context.SaveChangesAsync();
}

View File

@@ -1,12 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"PostgresConnection": "Host=localhost;Database=postgres;Username=postgres;Password="
}
}

View File

@@ -1,12 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"PostgresConnection": "Host=localhost;Database=postgres;Username=postgres;Password="
}
}

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,21 @@
{
"runtimeOptions": {
"tfm": "net9.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "9.0.0"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "9.0.0"
}
],
"configProperties": {
"System.GC.Server": true,
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Reflection.NullabilityInfoContext.IsSupported": true,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

View File

@@ -0,0 +1 @@
{"Version":1,"ManifestType":"Build","Endpoints":[]}

Some files were not shown because too many files have changed in this diff Show More