Got most of admin panel working. Data issues fixed

This commit is contained in:
Vincent Allen
2025-09-02 09:27:23 -04:00
parent 3d82040e75
commit b2835f65c0
401 changed files with 10478 additions and 10675 deletions

View File

@@ -1,380 +0,0 @@
// <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(ArchiveDbContext))]
[Migration("20250806141452_AllModels")]
partial class AllModels
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("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("ArtifactGroupingArtifactGrouping", b =>
{
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<int>("RelatedArtifactGroupingsId")
.HasColumnType("integer");
b.HasKey("ArtifactGroupingId", "RelatedArtifactGroupingsId");
b.HasIndex("RelatedArtifactGroupingsId");
b.ToTable("RelatedGroupings", (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("ArchiveCategory");
});
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<string>("ArtifactNumber")
.HasColumnType("text");
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
.HasColumnType("timestamp with time zone[]");
b.PrimitiveCollection<List<string>>("Defects")
.HasColumnType("text[]");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("FileTextContent")
.HasColumnType("text");
b.Property<bool>("IsPublicallyVisible")
.HasColumnType("boolean");
b.PrimitiveCollection<List<string>>("Links")
.HasColumnType("text[]");
b.PrimitiveCollection<List<string>>("ListedNames")
.HasColumnType("text[]");
b.Property<int?>("ParentArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("StorageLocation")
.HasColumnType("text");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactGroupingId");
b.ToTable("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
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.AssociatedName", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssocaitedNames");
});
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("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("ArtifactGroupingArtifactGrouping", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany()
.HasForeignKey("ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany()
.HasForeignKey("RelatedArtifactGroupingsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ParentArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ParentArtifactGroupingId");
b.Navigation("ParentArtifactGrouping");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany("ChildTags")
.HasForeignKey("ArtifactGroupingId");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.HasOne("OpenArchival.DataAccess.ArchiveCategory", "Category")
.WithMany()
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("OpenArchival.DataAccess.IdentifierFields", "IdentifierFields", b1 =>
{
b1.Property<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.AssociatedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany()
.HasForeignKey("ParentArtifactEntryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany("Files")
.HasForeignKey("ParentArtifactEntryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
b.Navigation("ChildTags");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,380 +0,0 @@
// <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(ArchiveDbContext))]
[Migration("20250806144037_AllModelsFixedComparer")]
partial class AllModelsFixedComparer
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("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("ArtifactGroupingArtifactGrouping", b =>
{
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<int>("RelatedArtifactGroupingsId")
.HasColumnType("integer");
b.HasKey("ArtifactGroupingId", "RelatedArtifactGroupingsId");
b.HasIndex("RelatedArtifactGroupingsId");
b.ToTable("RelatedGroupings", (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("ArchiveCategory");
});
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<string>("ArtifactNumber")
.HasColumnType("text");
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
.HasColumnType("timestamp with time zone[]");
b.PrimitiveCollection<List<string>>("Defects")
.HasColumnType("text[]");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("FileTextContent")
.HasColumnType("text");
b.Property<bool>("IsPublicallyVisible")
.HasColumnType("boolean");
b.PrimitiveCollection<List<string>>("Links")
.HasColumnType("text[]");
b.PrimitiveCollection<List<string>>("ListedNames")
.HasColumnType("text[]");
b.Property<int?>("ParentArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("StorageLocation")
.HasColumnType("text");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactGroupingId");
b.ToTable("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
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.AssociatedName", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssocaitedNames");
});
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("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("ArtifactGroupingArtifactGrouping", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany()
.HasForeignKey("ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany()
.HasForeignKey("RelatedArtifactGroupingsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ParentArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ParentArtifactGroupingId");
b.Navigation("ParentArtifactGrouping");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany("ChildTags")
.HasForeignKey("ArtifactGroupingId");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.HasOne("OpenArchival.DataAccess.ArchiveCategory", "Category")
.WithMany()
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("OpenArchival.DataAccess.IdentifierFields", "IdentifierFields", b1 =>
{
b1.Property<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.AssociatedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany()
.HasForeignKey("ParentArtifactEntryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany("Files")
.HasForeignKey("ParentArtifactEntryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
b.Navigation("ChildTags");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,59 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class NullableParentArtifactEntryId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactFilePaths_ArtifactEntries_ParentArtifactEntryId",
table: "ArtifactFilePaths");
migrationBuilder.AlterColumn<int>(
name: "ParentArtifactEntryId",
table: "ArtifactFilePaths",
type: "integer",
nullable: true,
oldClrType: typeof(int),
oldType: "integer");
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.AlterColumn<int>(
name: "ParentArtifactEntryId",
table: "ArtifactFilePaths",
type: "integer",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_ArtifactFilePaths_ArtifactEntries_ParentArtifactEntryId",
table: "ArtifactFilePaths",
column: "ParentArtifactEntryId",
principalTable: "ArtifactEntries",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@@ -1,77 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class AddStorageLocations : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "StorageLocation",
table: "ArtifactEntries");
migrationBuilder.AddColumn<int>(
name: "StorageLocationId",
table: "ArtifactEntries",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateTable(
name: "ArtifactStorageLocations",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Location = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ArtifactStorageLocations", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_ArtifactEntries_StorageLocationId",
table: "ArtifactEntries",
column: "StorageLocationId");
migrationBuilder.AddForeignKey(
name: "FK_ArtifactEntries_ArtifactStorageLocations_StorageLocationId",
table: "ArtifactEntries",
column: "StorageLocationId",
principalTable: "ArtifactStorageLocations",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactEntries_ArtifactStorageLocations_StorageLocationId",
table: "ArtifactEntries");
migrationBuilder.DropTable(
name: "ArtifactStorageLocations");
migrationBuilder.DropIndex(
name: "IX_ArtifactEntries_StorageLocationId",
table: "ArtifactEntries");
migrationBuilder.DropColumn(
name: "StorageLocationId",
table: "ArtifactEntries");
migrationBuilder.AddColumn<string>(
name: "StorageLocation",
table: "ArtifactEntries",
type: "text",
nullable: true);
}
}
}

View File

@@ -1,105 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class FixTypo : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactAssocaitedNames_ArtifactEntries_ParentArtifactEntry~",
table: "ArtifactAssocaitedNames");
migrationBuilder.DropPrimaryKey(
name: "PK_ArtifactAssocaitedNames",
table: "ArtifactAssocaitedNames");
migrationBuilder.RenameTable(
name: "ArtifactAssocaitedNames",
newName: "ArtifactAssociatedNames");
migrationBuilder.RenameColumn(
name: "IsPublicallyVisible",
table: "ArtifactEntries",
newName: "IsPubliclyVisible");
migrationBuilder.RenameIndex(
name: "IX_ArtifactAssocaitedNames_ParentArtifactEntryId",
table: "ArtifactAssociatedNames",
newName: "IX_ArtifactAssociatedNames_ParentArtifactEntryId");
migrationBuilder.AddPrimaryKey(
name: "PK_ArtifactAssociatedNames",
table: "ArtifactAssociatedNames",
column: "Id");
migrationBuilder.CreateTable(
name: "ArtifactTypes",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ArtifactTypes", x => x.Id);
});
migrationBuilder.AddForeignKey(
name: "FK_ArtifactAssociatedNames_ArtifactEntries_ParentArtifactEntry~",
table: "ArtifactAssociatedNames",
column: "ParentArtifactEntryId",
principalTable: "ArtifactEntries",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactAssociatedNames_ArtifactEntries_ParentArtifactEntry~",
table: "ArtifactAssociatedNames");
migrationBuilder.DropTable(
name: "ArtifactTypes");
migrationBuilder.DropPrimaryKey(
name: "PK_ArtifactAssociatedNames",
table: "ArtifactAssociatedNames");
migrationBuilder.RenameTable(
name: "ArtifactAssociatedNames",
newName: "ArtifactAssocaitedNames");
migrationBuilder.RenameColumn(
name: "IsPubliclyVisible",
table: "ArtifactEntries",
newName: "IsPublicallyVisible");
migrationBuilder.RenameIndex(
name: "IX_ArtifactAssociatedNames_ParentArtifactEntryId",
table: "ArtifactAssocaitedNames",
newName: "IX_ArtifactAssocaitedNames_ParentArtifactEntryId");
migrationBuilder.AddPrimaryKey(
name: "PK_ArtifactAssocaitedNames",
table: "ArtifactAssocaitedNames",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ArtifactAssocaitedNames_ArtifactEntries_ParentArtifactEntry~",
table: "ArtifactAssocaitedNames",
column: "ParentArtifactEntryId",
principalTable: "ArtifactEntries",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@@ -12,9 +12,9 @@ using OpenArchival.DataAccess;
namespace OpenArchival.DataAccess.Migrations
{
[DbContext(typeof(ArchiveDbContext))]
[Migration("20250807180849_FixTypo")]
partial class FixTypo
[DbContext(typeof(ApplicationDbContext))]
[Migration("20250812183602_InitalCreate")]
partial class InitalCreate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -243,7 +243,33 @@ namespace OpenArchival.DataAccess.Migrations
b.ToTable("ArtifactTypes");
});
modelBuilder.Entity("OpenArchival.DataAccess.AssociatedName", b =>
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()
@@ -272,32 +298,6 @@ namespace OpenArchival.DataAccess.Migrations
b.ToTable("ArtifactAssociatedNames");
});
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("ArtifactEntryArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
@@ -385,7 +385,16 @@ namespace OpenArchival.DataAccess.Migrations
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.AssociatedName", b =>
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany("Files")
.HasForeignKey("ParentArtifactEntryId");
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany()
@@ -396,15 +405,6 @@ namespace OpenArchival.DataAccess.Migrations
b.Navigation("ParentArtifactEntry");
});
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");

View File

@@ -8,7 +8,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class AllModels : Migration
public partial class InitalCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@@ -43,6 +43,32 @@ namespace OpenArchival.DataAccess.Migrations
table.PrimaryKey("PK_ArtifactDefects", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ArtifactStorageLocations",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Location = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ArtifactStorageLocations", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ArtifactTypes",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ArtifactTypes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ArtifactGroupings",
columns: table => new
@@ -76,14 +102,14 @@ namespace OpenArchival.DataAccess.Migrations
ArtifactNumber = table.Column<string>(type: "text", nullable: true),
Title = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: true),
StorageLocation = table.Column<string>(type: "text", nullable: true),
StorageLocationId = table.Column<int>(type: "integer", nullable: false),
ListedNames = table.Column<List<string>>(type: "text[]", nullable: true),
AssociatedDates = table.Column<List<DateTime>>(type: "timestamp with time zone[]", nullable: true),
Defects = table.Column<List<string>>(type: "text[]", nullable: true),
Links = table.Column<List<string>>(type: "text[]", nullable: true),
ParentArtifactGroupingId = table.Column<int>(type: "integer", nullable: true),
FileTextContent = table.Column<string>(type: "text", nullable: true),
IsPublicallyVisible = table.Column<bool>(type: "boolean", nullable: false)
IsPubliclyVisible = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
@@ -93,6 +119,12 @@ namespace OpenArchival.DataAccess.Migrations
column: x => x.ParentArtifactGroupingId,
principalTable: "ArtifactGroupings",
principalColumn: "Id");
table.ForeignKey(
name: "FK_ArtifactEntries_ArtifactStorageLocations_StorageLocationId",
column: x => x.StorageLocationId,
principalTable: "ArtifactStorageLocations",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
@@ -139,7 +171,7 @@ namespace OpenArchival.DataAccess.Migrations
});
migrationBuilder.CreateTable(
name: "ArtifactAssocaitedNames",
name: "ArtifactAssociatedNames",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
@@ -151,9 +183,9 @@ namespace OpenArchival.DataAccess.Migrations
},
constraints: table =>
{
table.PrimaryKey("PK_ArtifactAssocaitedNames", x => x.Id);
table.PrimaryKey("PK_ArtifactAssociatedNames", x => x.Id);
table.ForeignKey(
name: "FK_ArtifactAssocaitedNames_ArtifactEntries_ParentArtifactEntry~",
name: "FK_ArtifactAssociatedNames_ArtifactEntries_ParentArtifactEntry~",
column: x => x.ParentArtifactEntryId,
principalTable: "ArtifactEntries",
principalColumn: "Id",
@@ -166,7 +198,7 @@ namespace OpenArchival.DataAccess.Migrations
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ParentArtifactEntryId = table.Column<int>(type: "integer", nullable: false),
ParentArtifactEntryId = table.Column<int>(type: "integer", nullable: true),
OriginalName = table.Column<string>(type: "text", nullable: false),
Path = table.Column<string>(type: "text", nullable: false)
},
@@ -177,8 +209,7 @@ namespace OpenArchival.DataAccess.Migrations
name: "FK_ArtifactFilePaths_ArtifactEntries_ParentArtifactEntryId",
column: x => x.ParentArtifactEntryId,
principalTable: "ArtifactEntries",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
principalColumn: "Id");
});
migrationBuilder.CreateTable(
@@ -206,8 +237,8 @@ namespace OpenArchival.DataAccess.Migrations
});
migrationBuilder.CreateIndex(
name: "IX_ArtifactAssocaitedNames_ParentArtifactEntryId",
table: "ArtifactAssocaitedNames",
name: "IX_ArtifactAssociatedNames_ParentArtifactEntryId",
table: "ArtifactAssociatedNames",
column: "ParentArtifactEntryId");
migrationBuilder.CreateIndex(
@@ -215,6 +246,11 @@ namespace OpenArchival.DataAccess.Migrations
table: "ArtifactEntries",
column: "ParentArtifactGroupingId");
migrationBuilder.CreateIndex(
name: "IX_ArtifactEntries_StorageLocationId",
table: "ArtifactEntries",
column: "StorageLocationId");
migrationBuilder.CreateIndex(
name: "IX_ArtifactEntryArtifactEntryTag_TagsId",
table: "ArtifactEntryArtifactEntryTag",
@@ -245,7 +281,7 @@ namespace OpenArchival.DataAccess.Migrations
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ArtifactAssocaitedNames");
name: "ArtifactAssociatedNames");
migrationBuilder.DropTable(
name: "ArtifactDefects");
@@ -256,6 +292,9 @@ namespace OpenArchival.DataAccess.Migrations
migrationBuilder.DropTable(
name: "ArtifactFilePaths");
migrationBuilder.DropTable(
name: "ArtifactTypes");
migrationBuilder.DropTable(
name: "RelatedGroupings");
@@ -268,6 +307,9 @@ namespace OpenArchival.DataAccess.Migrations
migrationBuilder.DropTable(
name: "ArtifactGroupings");
migrationBuilder.DropTable(
name: "ArtifactStorageLocations");
migrationBuilder.DropTable(
name: "ArchiveCategory");
}

View File

@@ -0,0 +1,422 @@
// <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("20250813011348_ChangedArtifactRelationships")]
partial class ChangedArtifactRelationships
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.Property<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("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("ArchiveCategory");
});
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<string>("ArtifactNumber")
.HasColumnType("text");
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
.HasColumnType("timestamp with time zone[]");
b.PrimitiveCollection<List<string>>("Defects")
.HasColumnType("text[]");
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.PrimitiveCollection<List<string>>("ListedNames")
.HasColumnType("text[]");
b.Property<int?>("ParentArtifactGroupingId")
.HasColumnType("integer");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactGroupingId");
b.HasIndex("StorageLocationId");
b.ToTable("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
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>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedToId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null)
.WithMany()
.HasForeignKey("TagsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ParentArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ParentArtifactGroupingId");
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany()
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactGrouping");
b.Navigation("StorageLocation");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany("ChildTags")
.HasForeignKey("ArtifactGroupingId");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.HasOne("OpenArchival.DataAccess.ArchiveCategory", "Category")
.WithMany()
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("OpenArchival.DataAccess.IdentifierFields", "IdentifierFields", b1 =>
{
b1.Property<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.ListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany()
.HasForeignKey("ParentArtifactEntryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
b.Navigation("ChildTags");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,82 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class ChangedArtifactRelationships : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "RelatedGroupings");
migrationBuilder.CreateTable(
name: "ArtifactRelationships",
columns: table => new
{
RelatedById = table.Column<int>(type: "integer", nullable: false),
RelatedToId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ArtifactRelationships", x => new { x.RelatedById, x.RelatedToId });
table.ForeignKey(
name: "FK_ArtifactRelationships_ArtifactEntries_RelatedById",
column: x => x.RelatedById,
principalTable: "ArtifactEntries",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ArtifactRelationships_ArtifactEntries_RelatedToId",
column: x => x.RelatedToId,
principalTable: "ArtifactEntries",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ArtifactRelationships_RelatedToId",
table: "ArtifactRelationships",
column: "RelatedToId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ArtifactRelationships");
migrationBuilder.CreateTable(
name: "RelatedGroupings",
columns: table => new
{
ArtifactGroupingId = table.Column<int>(type: "integer", nullable: false),
RelatedArtifactGroupingsId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RelatedGroupings", x => new { x.ArtifactGroupingId, x.RelatedArtifactGroupingsId });
table.ForeignKey(
name: "FK_RelatedGroupings_ArtifactGroupings_ArtifactGroupingId",
column: x => x.ArtifactGroupingId,
principalTable: "ArtifactGroupings",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RelatedGroupings_ArtifactGroupings_RelatedArtifactGroupings~",
column: x => x.RelatedArtifactGroupingsId,
principalTable: "ArtifactGroupings",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_RelatedGroupings_RelatedArtifactGroupingsId",
table: "RelatedGroupings",
column: "RelatedArtifactGroupingsId");
}
}
}

View File

@@ -12,9 +12,9 @@ using OpenArchival.DataAccess;
namespace OpenArchival.DataAccess.Migrations
{
[DbContext(typeof(ArchiveDbContext))]
[Migration("20250806174205_NullableParentArtifactEntryId")]
partial class NullableParentArtifactEntryId
[DbContext(typeof(ApplicationDbContext))]
[Migration("20250813015341_AutoGenKeysEnabled")]
partial class AutoGenKeysEnabled
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -26,6 +26,21 @@ namespace OpenArchival.DataAccess.Migrations
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")
@@ -41,21 +56,6 @@ namespace OpenArchival.DataAccess.Migrations
b.ToTable("ArtifactEntryArtifactEntryTag");
});
modelBuilder.Entity("ArtifactGroupingArtifactGrouping", b =>
{
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<int>("RelatedArtifactGroupingsId")
.HasColumnType("integer");
b.HasKey("ArtifactGroupingId", "RelatedArtifactGroupingsId");
b.HasIndex("RelatedArtifactGroupingsId");
b.ToTable("RelatedGroupings", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ArchiveCategory", b =>
{
b.Property<int>("Id")
@@ -128,7 +128,7 @@ namespace OpenArchival.DataAccess.Migrations
b.Property<string>("FileTextContent")
.HasColumnType("text");
b.Property<bool>("IsPublicallyVisible")
b.Property<bool>("IsPubliclyVisible")
.HasColumnType("boolean");
b.PrimitiveCollection<List<string>>("Links")
@@ -140,8 +140,8 @@ namespace OpenArchival.DataAccess.Migrations
b.Property<int?>("ParentArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("StorageLocation")
.HasColumnType("text");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
@@ -151,6 +151,8 @@ namespace OpenArchival.DataAccess.Migrations
b.HasIndex("ParentArtifactGroupingId");
b.HasIndex("StorageLocationId");
b.ToTable("ArtifactEntries");
});
@@ -207,7 +209,7 @@ namespace OpenArchival.DataAccess.Migrations
b.ToTable("ArtifactGroupings");
});
modelBuilder.Entity("OpenArchival.DataAccess.AssociatedName", b =>
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@@ -215,25 +217,30 @@ namespace OpenArchival.DataAccess.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("FirstName")
b.Property<string>("Location")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactStorageLocations");
});
b.ToTable("ArtifactAssocaitedNames");
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 =>
@@ -262,6 +269,50 @@ namespace OpenArchival.DataAccess.Migrations
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>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedToId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
@@ -277,28 +328,21 @@ namespace OpenArchival.DataAccess.Migrations
.IsRequired();
});
modelBuilder.Entity("ArtifactGroupingArtifactGrouping", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany()
.HasForeignKey("ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany()
.HasForeignKey("RelatedArtifactGroupingsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ParentArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ParentArtifactGroupingId");
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany()
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactGrouping");
b.Navigation("StorageLocation");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
@@ -341,7 +385,16 @@ namespace OpenArchival.DataAccess.Migrations
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.AssociatedName", b =>
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany("Files")
.HasForeignKey("ParentArtifactEntryId");
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany()
@@ -352,15 +405,6 @@ namespace OpenArchival.DataAccess.Migrations
b.Navigation("ParentArtifactEntry");
});
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");

View File

@@ -5,7 +5,7 @@
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class AllModelsFixedComparer : Migration
public partial class AutoGenKeysEnabled : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)

View File

@@ -0,0 +1,422 @@
// <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("20250813023107_ChangedArtifactRelationshipsNew")]
partial class ChangedArtifactRelationshipsNew
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.Property<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("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("ArchiveCategory");
});
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<string>("ArtifactNumber")
.HasColumnType("text");
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
.HasColumnType("timestamp with time zone[]");
b.PrimitiveCollection<List<string>>("Defects")
.HasColumnType("text[]");
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.PrimitiveCollection<List<string>>("ListedNames")
.HasColumnType("text[]");
b.Property<int?>("ParentArtifactGroupingId")
.HasColumnType("integer");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactGroupingId");
b.HasIndex("StorageLocationId");
b.ToTable("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
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>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedToId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null)
.WithMany()
.HasForeignKey("TagsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ParentArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ParentArtifactGroupingId");
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany()
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactGrouping");
b.Navigation("StorageLocation");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany("ChildTags")
.HasForeignKey("ArtifactGroupingId");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.HasOne("OpenArchival.DataAccess.ArchiveCategory", "Category")
.WithMany()
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("OpenArchival.DataAccess.IdentifierFields", "IdentifierFields", b1 =>
{
b1.Property<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.ListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany()
.HasForeignKey("ParentArtifactEntryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
b.Navigation("ChildTags");
});
#pragma warning restore 612, 618
}
}
}

View File

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

View File

@@ -12,9 +12,9 @@ using OpenArchival.DataAccess;
namespace OpenArchival.DataAccess.Migrations
{
[DbContext(typeof(ArchiveDbContext))]
[Migration("20250807132100_FixType")]
partial class FixType
[DbContext(typeof(ApplicationDbContext))]
[Migration("20250813024912_RemovedDuplicateCategories")]
partial class RemovedDuplicateCategories
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -26,6 +26,21 @@ namespace OpenArchival.DataAccess.Migrations
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")
@@ -41,21 +56,6 @@ namespace OpenArchival.DataAccess.Migrations
b.ToTable("ArtifactEntryArtifactEntryTag");
});
modelBuilder.Entity("ArtifactGroupingArtifactGrouping", b =>
{
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<int>("RelatedArtifactGroupingsId")
.HasColumnType("integer");
b.HasKey("ArtifactGroupingId", "RelatedArtifactGroupingsId");
b.HasIndex("RelatedArtifactGroupingsId");
b.ToTable("RelatedGroupings", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ArchiveCategory", b =>
{
b.Property<int>("Id")
@@ -128,7 +128,7 @@ namespace OpenArchival.DataAccess.Migrations
b.Property<string>("FileTextContent")
.HasColumnType("text");
b.Property<bool>("IsPublicallyVisible")
b.Property<bool>("IsPubliclyVisible")
.HasColumnType("boolean");
b.PrimitiveCollection<List<string>>("Links")
@@ -164,17 +164,12 @@ namespace OpenArchival.DataAccess.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.ToTable("ArtifactEntryTags");
});
@@ -226,7 +221,7 @@ namespace OpenArchival.DataAccess.Migrations
b.ToTable("ArtifactStorageLocations");
});
modelBuilder.Entity("OpenArchival.DataAccess.AssociatedName", b =>
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@@ -234,25 +229,13 @@ namespace OpenArchival.DataAccess.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("FirstName")
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssocaitedNames");
b.ToTable("ArtifactTypes");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
@@ -281,6 +264,50 @@ namespace OpenArchival.DataAccess.Migrations
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>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedToId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
@@ -296,21 +323,6 @@ namespace OpenArchival.DataAccess.Migrations
.IsRequired();
});
modelBuilder.Entity("ArtifactGroupingArtifactGrouping", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany()
.HasForeignKey("ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany()
.HasForeignKey("RelatedArtifactGroupingsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ParentArtifactGrouping")
@@ -328,13 +340,6 @@ namespace OpenArchival.DataAccess.Migrations
b.Navigation("StorageLocation");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany("ChildTags")
.HasForeignKey("ArtifactGroupingId");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.HasOne("OpenArchival.DataAccess.ArchiveCategory", "Category")
@@ -368,7 +373,16 @@ namespace OpenArchival.DataAccess.Migrations
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.AssociatedName", b =>
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany("Files")
.HasForeignKey("ParentArtifactEntryId");
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany()
@@ -379,15 +393,6 @@ namespace OpenArchival.DataAccess.Migrations
b.Navigation("ParentArtifactEntry");
});
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");
@@ -396,8 +401,6 @@ namespace OpenArchival.DataAccess.Migrations
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
b.Navigation("ChildTags");
});
#pragma warning restore 612, 618
}

View File

@@ -0,0 +1,48 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class RemovedDuplicateCategories : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactEntryTags_ArtifactGroupings_ArtifactGroupingId",
table: "ArtifactEntryTags");
migrationBuilder.DropIndex(
name: "IX_ArtifactEntryTags_ArtifactGroupingId",
table: "ArtifactEntryTags");
migrationBuilder.DropColumn(
name: "ArtifactGroupingId",
table: "ArtifactEntryTags");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ArtifactGroupingId",
table: "ArtifactEntryTags",
type: "integer",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_ArtifactEntryTags_ArtifactGroupingId",
table: "ArtifactEntryTags",
column: "ArtifactGroupingId");
migrationBuilder.AddForeignKey(
name: "FK_ArtifactEntryTags_ArtifactGroupings_ArtifactGroupingId",
table: "ArtifactEntryTags",
column: "ArtifactGroupingId",
principalTable: "ArtifactGroupings",
principalColumn: "Id");
}
}
}

View File

@@ -12,9 +12,9 @@ using OpenArchival.DataAccess;
namespace OpenArchival.DataAccess.Migrations
{
[DbContext(typeof(ArchiveDbContext))]
[Migration("20250807131954_AddStorageLocations")]
partial class AddStorageLocations
[DbContext(typeof(ApplicationDbContext))]
[Migration("20250813025148_RemovedDuplicateCategoriesNew")]
partial class RemovedDuplicateCategoriesNew
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -26,6 +26,21 @@ namespace OpenArchival.DataAccess.Migrations
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")
@@ -41,21 +56,6 @@ namespace OpenArchival.DataAccess.Migrations
b.ToTable("ArtifactEntryArtifactEntryTag");
});
modelBuilder.Entity("ArtifactGroupingArtifactGrouping", b =>
{
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<int>("RelatedArtifactGroupingsId")
.HasColumnType("integer");
b.HasKey("ArtifactGroupingId", "RelatedArtifactGroupingsId");
b.HasIndex("RelatedArtifactGroupingsId");
b.ToTable("RelatedGroupings", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ArchiveCategory", b =>
{
b.Property<int>("Id")
@@ -85,7 +85,7 @@ namespace OpenArchival.DataAccess.Migrations
b.HasKey("Id");
b.ToTable("ArchiveCategory");
b.ToTable("ArchiveCategories");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b =>
@@ -128,7 +128,7 @@ namespace OpenArchival.DataAccess.Migrations
b.Property<string>("FileTextContent")
.HasColumnType("text");
b.Property<bool>("IsPublicallyVisible")
b.Property<bool>("IsPubliclyVisible")
.HasColumnType("boolean");
b.PrimitiveCollection<List<string>>("Links")
@@ -164,17 +164,12 @@ namespace OpenArchival.DataAccess.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.ToTable("ArtifactEntryTags");
});
@@ -226,7 +221,7 @@ namespace OpenArchival.DataAccess.Migrations
b.ToTable("ArtifactStorageLocations");
});
modelBuilder.Entity("OpenArchival.DataAccess.AssociatedName", b =>
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@@ -234,25 +229,13 @@ namespace OpenArchival.DataAccess.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("FirstName")
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssocaitedNames");
b.ToTable("ArtifactTypes");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
@@ -281,6 +264,50 @@ namespace OpenArchival.DataAccess.Migrations
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>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedToId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
@@ -296,21 +323,6 @@ namespace OpenArchival.DataAccess.Migrations
.IsRequired();
});
modelBuilder.Entity("ArtifactGroupingArtifactGrouping", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany()
.HasForeignKey("ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany()
.HasForeignKey("RelatedArtifactGroupingsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ParentArtifactGrouping")
@@ -328,13 +340,6 @@ namespace OpenArchival.DataAccess.Migrations
b.Navigation("StorageLocation");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany("ChildTags")
.HasForeignKey("ArtifactGroupingId");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.HasOne("OpenArchival.DataAccess.ArchiveCategory", "Category")
@@ -368,7 +373,16 @@ namespace OpenArchival.DataAccess.Migrations
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.AssociatedName", b =>
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany("Files")
.HasForeignKey("ParentArtifactEntryId");
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany()
@@ -379,15 +393,6 @@ namespace OpenArchival.DataAccess.Migrations
b.Navigation("ParentArtifactEntry");
});
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");
@@ -396,8 +401,6 @@ namespace OpenArchival.DataAccess.Migrations
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
b.Navigation("ChildTags");
});
#pragma warning restore 612, 618
}

View File

@@ -0,0 +1,68 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class RemovedDuplicateCategoriesNew : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactGroupings_ArchiveCategory_CategoryId",
table: "ArtifactGroupings");
migrationBuilder.DropPrimaryKey(
name: "PK_ArchiveCategory",
table: "ArchiveCategory");
migrationBuilder.RenameTable(
name: "ArchiveCategory",
newName: "ArchiveCategories");
migrationBuilder.AddPrimaryKey(
name: "PK_ArchiveCategories",
table: "ArchiveCategories",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ArtifactGroupings_ArchiveCategories_CategoryId",
table: "ArtifactGroupings",
column: "CategoryId",
principalTable: "ArchiveCategories",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactGroupings_ArchiveCategories_CategoryId",
table: "ArtifactGroupings");
migrationBuilder.DropPrimaryKey(
name: "PK_ArchiveCategories",
table: "ArchiveCategories");
migrationBuilder.RenameTable(
name: "ArchiveCategories",
newName: "ArchiveCategory");
migrationBuilder.AddPrimaryKey(
name: "PK_ArchiveCategory",
table: "ArchiveCategory",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ArtifactGroupings_ArchiveCategory_CategoryId",
table: "ArtifactGroupings",
column: "CategoryId",
principalTable: "ArchiveCategory",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@@ -0,0 +1,659 @@
// <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("20250813153226_AddAuthentication")]
partial class AddAuthentication
{
/// <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("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<string>("ArtifactNumber")
.HasColumnType("text");
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
.HasColumnType("timestamp with time zone[]");
b.PrimitiveCollection<List<string>>("Defects")
.HasColumnType("text[]");
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.PrimitiveCollection<List<string>>("ListedNames")
.HasColumnType("text[]");
b.Property<int?>("ParentArtifactGroupingId")
.HasColumnType("integer");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactGroupingId");
b.HasIndex("StorageLocationId");
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>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedToId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null)
.WithMany()
.HasForeignKey("TagsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("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", "ParentArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ParentArtifactGroupingId");
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany()
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactGrouping");
b.Navigation("StorageLocation");
});
modelBuilder.Entity("OpenArchival.DataAccess.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.ListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany()
.HasForeignKey("ParentArtifactEntryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,224 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class AddAuthentication : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AspNetRoles",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetUsers",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
PermissionLevel = table.Column<string>(type: "text", nullable: false),
UserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
Email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
PasswordHash = table.Column<string>(type: "text", nullable: true),
SecurityStamp = table.Column<string>(type: "text", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
PhoneNumber = table.Column<string>(type: "text", nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false),
TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false),
AccessFailedCount = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetRoleClaims",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RoleId = table.Column<string>(type: "text", nullable: false),
ClaimType = table.Column<string>(type: "text", nullable: true),
ClaimValue = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
table.ForeignKey(
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserClaims",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
UserId = table.Column<string>(type: "text", nullable: false),
ClaimType = table.Column<string>(type: "text", nullable: true),
ClaimValue = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
table.ForeignKey(
name: "FK_AspNetUserClaims_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserLogins",
columns: table => new
{
LoginProvider = table.Column<string>(type: "text", nullable: false),
ProviderKey = table.Column<string>(type: "text", nullable: false),
ProviderDisplayName = table.Column<string>(type: "text", nullable: true),
UserId = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
table.ForeignKey(
name: "FK_AspNetUserLogins_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserRoles",
columns: table => new
{
UserId = table.Column<string>(type: "text", nullable: false),
RoleId = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserTokens",
columns: table => new
{
UserId = table.Column<string>(type: "text", nullable: false),
LoginProvider = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Value = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.ForeignKey(
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AspNetRoleClaims_RoleId",
table: "AspNetRoleClaims",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "AspNetRoles",
column: "NormalizedName",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AspNetUserClaims_UserId",
table: "AspNetUserClaims",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserLogins_UserId",
table: "AspNetUserLogins",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserRoles_RoleId",
table: "AspNetUserRoles",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "EmailIndex",
table: "AspNetUsers",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "UserNameIndex",
table: "AspNetUsers",
column: "NormalizedUserName",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AspNetRoleClaims");
migrationBuilder.DropTable(
name: "AspNetUserClaims");
migrationBuilder.DropTable(
name: "AspNetUserLogins");
migrationBuilder.DropTable(
name: "AspNetUserRoles");
migrationBuilder.DropTable(
name: "AspNetUserTokens");
migrationBuilder.DropTable(
name: "AspNetRoles");
migrationBuilder.DropTable(
name: "AspNetUsers");
}
}
}

View File

@@ -0,0 +1,659 @@
// <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("20250828154443_AddedParentEntry")]
partial class AddedParentEntry
{
/// <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("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<string>("ArtifactNumber")
.HasColumnType("text");
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
.HasColumnType("timestamp with time zone[]");
b.PrimitiveCollection<List<string>>("Defects")
.HasColumnType("text[]");
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.PrimitiveCollection<List<string>>("ListedNames")
.HasColumnType("text[]");
b.Property<int?>("ParentArtifactGroupingId")
.HasColumnType("integer");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactGroupingId");
b.HasIndex("StorageLocationId");
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>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedToId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null)
.WithMany()
.HasForeignKey("TagsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("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", "ParentArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ParentArtifactGroupingId");
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany()
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactGrouping");
b.Navigation("StorageLocation");
});
modelBuilder.Entity("OpenArchival.DataAccess.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.ListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany()
.HasForeignKey("ParentArtifactEntryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
});
#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 AddedParentEntry : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@@ -0,0 +1,672 @@
// <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("20250828173516_AddedCascade")]
partial class AddedCascade
{
/// <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("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.PrimitiveCollection<List<string>>("Defects")
.HasColumnType("text[]");
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.PrimitiveCollection<List<string>>("ListedNames")
.HasColumnType("text[]");
b.Property<int?>("ParentArtifactGroupingId")
.HasColumnType("integer");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("ParentArtifactGroupingId");
b.HasIndex("StorageLocationId");
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>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedToId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null)
.WithMany()
.HasForeignKey("TagsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("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.ArtifactGrouping", "ParentArtifactGrouping")
.WithMany()
.HasForeignKey("ParentArtifactGroupingId");
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany()
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ArtifactGrouping");
b.Navigation("ParentArtifactGrouping");
b.Navigation("StorageLocation");
});
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.ListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany()
.HasForeignKey("ParentArtifactEntryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,50 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class AddedCascade : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ArtifactGroupingId",
table: "ArtifactEntries",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateIndex(
name: "IX_ArtifactEntries_ArtifactGroupingId",
table: "ArtifactEntries",
column: "ArtifactGroupingId");
migrationBuilder.AddForeignKey(
name: "FK_ArtifactEntries_ArtifactGroupings_ArtifactGroupingId",
table: "ArtifactEntries",
column: "ArtifactGroupingId",
principalTable: "ArtifactGroupings",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactEntries_ArtifactGroupings_ArtifactGroupingId",
table: "ArtifactEntries");
migrationBuilder.DropIndex(
name: "IX_ArtifactEntries_ArtifactGroupingId",
table: "ArtifactEntries");
migrationBuilder.DropColumn(
name: "ArtifactGroupingId",
table: "ArtifactEntries");
}
}
}

View File

@@ -0,0 +1,672 @@
// <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("20250829171154_UniqueRowsSet")]
partial class UniqueRowsSet
{
/// <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("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.PrimitiveCollection<List<string>>("Defects")
.HasColumnType("text[]");
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.PrimitiveCollection<List<string>>("ListedNames")
.HasColumnType("text[]");
b.Property<int?>("ParentArtifactGroupingId")
.HasColumnType("integer");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("ParentArtifactGroupingId");
b.HasIndex("StorageLocationId");
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>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedToId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null)
.WithMany()
.HasForeignKey("TagsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("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.ArtifactGrouping", "ParentArtifactGrouping")
.WithMany()
.HasForeignKey("ParentArtifactGroupingId");
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany()
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ArtifactGrouping");
b.Navigation("ParentArtifactGrouping");
b.Navigation("StorageLocation");
});
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.ListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany()
.HasForeignKey("ParentArtifactEntryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -5,7 +5,7 @@
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class FixType : Migration
public partial class UniqueRowsSet : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)

View File

@@ -0,0 +1,672 @@
// <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("20250829182114_FixedCascadeDelete")]
partial class FixedCascadeDelete
{
/// <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("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.PrimitiveCollection<List<string>>("Defects")
.HasColumnType("text[]");
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.PrimitiveCollection<List<string>>("ListedNames")
.HasColumnType("text[]");
b.Property<int?>("ParentArtifactGroupingId")
.HasColumnType("integer");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("ParentArtifactGroupingId");
b.HasIndex("StorageLocationId");
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>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedToId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null)
.WithMany()
.HasForeignKey("TagsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("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.ArtifactGrouping", "ParentArtifactGrouping")
.WithMany()
.HasForeignKey("ParentArtifactGroupingId");
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany()
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ArtifactGrouping");
b.Navigation("ParentArtifactGrouping");
b.Navigation("StorageLocation");
});
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.ListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany()
.HasForeignKey("ParentArtifactEntryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
});
#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 FixedCascadeDelete : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@@ -0,0 +1,661 @@
// <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("20250829182730_fixedduplicateprop")]
partial class fixedduplicateprop
{
/// <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("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.PrimitiveCollection<List<string>>("Defects")
.HasColumnType("text[]");
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.PrimitiveCollection<List<string>>("ListedNames")
.HasColumnType("text[]");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("StorageLocationId");
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>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedToId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null)
.WithMany()
.HasForeignKey("TagsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("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.Navigation("ArtifactGrouping");
b.Navigation("StorageLocation");
});
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.ListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany()
.HasForeignKey("ParentArtifactEntryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,48 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class fixedduplicateprop : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactEntries_ArtifactGroupings_ParentArtifactGroupingId",
table: "ArtifactEntries");
migrationBuilder.DropIndex(
name: "IX_ArtifactEntries_ParentArtifactGroupingId",
table: "ArtifactEntries");
migrationBuilder.DropColumn(
name: "ParentArtifactGroupingId",
table: "ArtifactEntries");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ParentArtifactGroupingId",
table: "ArtifactEntries",
type: "integer",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_ArtifactEntries_ParentArtifactGroupingId",
table: "ArtifactEntries",
column: "ParentArtifactGroupingId");
migrationBuilder.AddForeignKey(
name: "FK_ArtifactEntries_ArtifactGroupings_ParentArtifactGroupingId",
table: "ArtifactEntries",
column: "ParentArtifactGroupingId",
principalTable: "ArtifactGroupings",
principalColumn: "Id");
}
}
}

View File

@@ -0,0 +1,677 @@
// <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("20250829200117_deduplicationadded")]
partial class deduplicationadded
{
/// <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("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<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedToId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null)
.WithMany()
.HasForeignKey("TagsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("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()
.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.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");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,132 @@
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class deduplicationadded : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Defects",
table: "ArtifactEntries");
migrationBuilder.DropColumn(
name: "ListedNames",
table: "ArtifactEntries");
migrationBuilder.DropColumn(
name: "FirstName",
table: "ArtifactAssociatedNames");
migrationBuilder.DropColumn(
name: "Title",
table: "ArtifactAssociatedNames");
migrationBuilder.RenameColumn(
name: "LastName",
table: "ArtifactAssociatedNames",
newName: "Value");
migrationBuilder.AddColumn<int>(
name: "TypeId",
table: "ArtifactEntries",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "ArtifactEntryId",
table: "ArtifactDefects",
type: "integer",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_ArtifactEntries_TypeId",
table: "ArtifactEntries",
column: "TypeId");
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");
migrationBuilder.AddForeignKey(
name: "FK_ArtifactEntries_ArtifactTypes_TypeId",
table: "ArtifactEntries",
column: "TypeId",
principalTable: "ArtifactTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ArtifactDefects_ArtifactEntries_ArtifactEntryId",
table: "ArtifactDefects");
migrationBuilder.DropForeignKey(
name: "FK_ArtifactEntries_ArtifactTypes_TypeId",
table: "ArtifactEntries");
migrationBuilder.DropIndex(
name: "IX_ArtifactEntries_TypeId",
table: "ArtifactEntries");
migrationBuilder.DropIndex(
name: "IX_ArtifactDefects_ArtifactEntryId",
table: "ArtifactDefects");
migrationBuilder.DropColumn(
name: "TypeId",
table: "ArtifactEntries");
migrationBuilder.DropColumn(
name: "ArtifactEntryId",
table: "ArtifactDefects");
migrationBuilder.RenameColumn(
name: "Value",
table: "ArtifactAssociatedNames",
newName: "LastName");
migrationBuilder.AddColumn<List<string>>(
name: "Defects",
table: "ArtifactEntries",
type: "text[]",
nullable: true);
migrationBuilder.AddColumn<List<string>>(
name: "ListedNames",
table: "ArtifactEntries",
type: "text[]",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "FirstName",
table: "ArtifactAssociatedNames",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "Title",
table: "ArtifactAssociatedNames",
type: "text",
nullable: true);
}
}
}

View File

@@ -11,18 +11,33 @@ using OpenArchival.DataAccess;
namespace OpenArchival.DataAccess.Migrations
{
[DbContext(typeof(ArchiveDbContext))]
[DbContext(typeof(ApplicationDbContext))]
partial class ArchiveDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.7")
.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")
@@ -38,19 +53,204 @@ namespace OpenArchival.DataAccess.Migrations
b.ToTable("ArtifactEntryArtifactEntryTag");
});
modelBuilder.Entity("ArtifactGroupingArtifactGrouping", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<int>("ArtifactGroupingId")
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");
b.Property<int>("RelatedArtifactGroupingsId")
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");
b.HasKey("ArtifactGroupingId", "RelatedArtifactGroupingsId");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.HasIndex("RelatedArtifactGroupingsId");
b.Property<string>("ClaimType")
.HasColumnType("text");
b.ToTable("RelatedGroupings", (string)null);
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 =>
@@ -82,7 +282,7 @@ namespace OpenArchival.DataAccess.Migrations
b.HasKey("Id");
b.ToTable("ArchiveCategory");
b.ToTable("ArchiveCategories");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b =>
@@ -93,12 +293,17 @@ 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");
});
@@ -110,15 +315,15 @@ namespace OpenArchival.DataAccess.Migrations
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.PrimitiveCollection<List<string>>("Defects")
.HasColumnType("text[]");
b.Property<string>("Description")
.HasColumnType("text");
@@ -131,12 +336,6 @@ namespace OpenArchival.DataAccess.Migrations
b.PrimitiveCollection<List<string>>("Links")
.HasColumnType("text[]");
b.PrimitiveCollection<List<string>>("ListedNames")
.HasColumnType("text[]");
b.Property<int?>("ParentArtifactGroupingId")
.HasColumnType("integer");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
@@ -144,12 +343,17 @@ namespace OpenArchival.DataAccess.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ParentArtifactGroupingId");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("StorageLocationId");
b.HasIndex("TypeId");
b.ToTable("ArtifactEntries");
});
@@ -161,17 +365,12 @@ namespace OpenArchival.DataAccess.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.ToTable("ArtifactEntryTags");
});
@@ -240,35 +439,6 @@ namespace OpenArchival.DataAccess.Migrations
b.ToTable("ArtifactTypes");
});
modelBuilder.Entity("OpenArchival.DataAccess.AssociatedName", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("text");
b.Property<int>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.Property<int>("Id")
@@ -295,6 +465,43 @@ namespace OpenArchival.DataAccess.Migrations
b.ToTable("ArtifactFilePaths");
});
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
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("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)
@@ -310,26 +517,71 @@ namespace OpenArchival.DataAccess.Migrations
.IsRequired();
});
modelBuilder.Entity("ArtifactGroupingArtifactGrouping", b =>
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany()
.HasForeignKey("RelatedArtifactGroupingsId")
.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", "ParentArtifactGrouping")
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ParentArtifactGroupingId");
.HasForeignKey("ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany()
@@ -337,16 +589,17 @@ namespace OpenArchival.DataAccess.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactGrouping");
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany()
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ArtifactGrouping");
b.Navigation("StorageLocation");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany("ChildTags")
.HasForeignKey("ArtifactGroupingId");
b.Navigation("Type");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
@@ -382,17 +635,6 @@ namespace OpenArchival.DataAccess.Migrations
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.AssociatedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany()
.HasForeignKey("ParentArtifactEntryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
@@ -402,16 +644,29 @@ 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");
b.Navigation("ChildTags");
});
#pragma warning restore 612, 618
}