Added basic search implementation with display components
This commit is contained in:
@@ -30,14 +30,6 @@ public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
/*
|
||||
modelBuilder.Entity<ArtifactEntry>()
|
||||
.HasMany(p => p.Files)
|
||||
.WithOne(p => p.ParentArtifactEntry)
|
||||
.IsRequired(false);
|
||||
*/
|
||||
|
||||
// Make other associations
|
||||
modelBuilder.Entity<ArtifactEntry>()
|
||||
.HasMany(a => a.RelatedTo)
|
||||
.WithMany(a => a.RelatedBy)
|
||||
@@ -76,5 +68,79 @@ public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options
|
||||
|
||||
sourceDictionary => new Dictionary<string, string>(sourceDictionary)
|
||||
);
|
||||
|
||||
modelBuilder.Entity<ArtifactGrouping>()
|
||||
.HasGeneratedTsVectorColumn(
|
||||
p => p.AllSearchVector,
|
||||
"english",
|
||||
p => p.AllSearchString
|
||||
)
|
||||
.HasIndex(p => p.AllSearchVector)
|
||||
.HasMethod("GIN");
|
||||
|
||||
modelBuilder.Entity<ArtifactGrouping>()
|
||||
.HasGeneratedTsVectorColumn(
|
||||
p => p.TagsSearchVector,
|
||||
"english",
|
||||
p => p.TagsSearchString
|
||||
)
|
||||
.HasIndex(p => p.TagsSearchVector)
|
||||
.HasMethod("GIN");
|
||||
|
||||
modelBuilder.Entity<ArtifactGrouping>()
|
||||
.HasGeneratedTsVectorColumn(
|
||||
p => p.DefectsSearchVector,
|
||||
"english",
|
||||
p => p.DefectsSearchString
|
||||
)
|
||||
.HasIndex(p => p.DefectsSearchVector)
|
||||
.HasMethod("GIN");
|
||||
|
||||
modelBuilder.Entity<ArtifactGrouping>()
|
||||
.HasGeneratedTsVectorColumn(
|
||||
p => p.ListedNamesSearchVector,
|
||||
"english",
|
||||
p => p.ListedNamesSearchString
|
||||
)
|
||||
.HasIndex(p => p.ListedNamesSearchVector)
|
||||
.HasMethod("GIN");
|
||||
|
||||
modelBuilder.Entity<ArtifactGrouping>()
|
||||
.HasGeneratedTsVectorColumn(
|
||||
p => p.TitleSearchVector,
|
||||
"english",
|
||||
p => p.TitleSearchString
|
||||
)
|
||||
.HasIndex(p => p.TitleSearchVector)
|
||||
.HasMethod("GIN");
|
||||
|
||||
modelBuilder.Entity<ArtifactGrouping>()
|
||||
.HasGeneratedTsVectorColumn(
|
||||
p => p.DescriptionSearchVector,
|
||||
"english",
|
||||
p => p.DescriptionSearchString
|
||||
)
|
||||
.HasIndex(p => p.DescriptionSearchVector)
|
||||
.HasMethod("GIN");
|
||||
|
||||
modelBuilder.Entity<ArtifactGrouping>()
|
||||
.HasGeneratedTsVectorColumn(
|
||||
p => p.FilenamesSearchVector,
|
||||
"english",
|
||||
p => p.FilenamesSearchString
|
||||
)
|
||||
.HasIndex(p => p.FilenamesSearchVector)
|
||||
.HasMethod("GIN");
|
||||
|
||||
modelBuilder.Entity<ArtifactGrouping>()
|
||||
.HasGeneratedTsVectorColumn(
|
||||
p => p.FileContentSearchVector,
|
||||
"english",
|
||||
p => p.FileContentSearchString
|
||||
)
|
||||
.HasIndex(p => p.FileContentSearchVector)
|
||||
.HasMethod("GIN");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
79
OpenArchival.DataAccess/GenerateSearchIndex.cs
Normal file
79
OpenArchival.DataAccess/GenerateSearchIndex.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System.Text;
|
||||
|
||||
namespace OpenArchival.DataAccess;
|
||||
|
||||
public static class ArtifactGroupingExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Concatinates all data that can be searched on into large strings so that Postgres can turn them into search vectors
|
||||
/// </summary>
|
||||
/// <param name="grouping"></param>
|
||||
public static void GenerateSearchIndex(this ArtifactGrouping grouping)
|
||||
{
|
||||
var allSearchSb = new StringBuilder();
|
||||
var tagsSb = new StringBuilder();
|
||||
var defectsSb = new StringBuilder();
|
||||
var listedNamesSb = new StringBuilder();
|
||||
var titlesSb = new StringBuilder();
|
||||
var descriptionsSb = new StringBuilder();
|
||||
var filenamesSb = new StringBuilder();
|
||||
var fileContentSb = new StringBuilder();
|
||||
|
||||
// Put all the top level data in
|
||||
allSearchSb.Append($"{grouping.Title} ");
|
||||
titlesSb.Append($"{grouping.Title} ");
|
||||
|
||||
allSearchSb.Append($"{grouping.Description} ");
|
||||
descriptionsSb.Append($"{grouping.Description} ");
|
||||
|
||||
foreach (ArtifactEntry entry in grouping.ChildArtifactEntries)
|
||||
{
|
||||
allSearchSb.Append($"{entry.Title} ");
|
||||
titlesSb.Append($"{entry.Title} ");
|
||||
|
||||
allSearchSb.Append($"{entry.Description} ");
|
||||
descriptionsSb.Append($"{entry.Description} ");
|
||||
|
||||
foreach (ArtifactEntryTag tag in entry.Tags)
|
||||
{
|
||||
allSearchSb.Append($"{tag.Name} ");
|
||||
tagsSb.Append($"{tag.Name} ");
|
||||
}
|
||||
|
||||
if (entry.Defects is not null) {
|
||||
foreach (ArtifactDefect defect in entry.Defects)
|
||||
{
|
||||
allSearchSb.Append($"{defect.Description} ");
|
||||
defectsSb.Append($"{defect.Description} ");
|
||||
}
|
||||
}
|
||||
|
||||
if (entry.ListedNames is not null)
|
||||
{
|
||||
foreach (ListedName name in entry.ListedNames)
|
||||
{
|
||||
allSearchSb.Append($"{name.Value} ");
|
||||
listedNamesSb.Append($"{name.Value} ");
|
||||
}
|
||||
}
|
||||
|
||||
foreach (FilePathListing file in entry.Files)
|
||||
{
|
||||
allSearchSb.Append($"{file.OriginalName} ");
|
||||
filenamesSb.Append($"{file.OriginalName} ");
|
||||
}
|
||||
|
||||
fileContentSb.Append($"{entry.FileTextContent} ");
|
||||
allSearchSb.Append($"{entry.FileTextContent} ");
|
||||
}
|
||||
|
||||
grouping.AllSearchString = allSearchSb.ToString();
|
||||
grouping.TagsSearchString = tagsSb.ToString();
|
||||
grouping.DefectsSearchString = defectsSb.ToString();
|
||||
grouping.ListedNamesSearchString = listedNamesSb.ToString();
|
||||
grouping.TitleSearchString = titlesSb.ToString();
|
||||
grouping.DescriptionSearchString = descriptionsSb.ToString();
|
||||
grouping.FilenamesSearchString = filenamesSb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
837
OpenArchival.DataAccess/Migrations/20251010184626_ArtifactGroupingsSearchVectorColumns.Designer.cs
generated
Normal file
837
OpenArchival.DataAccess/Migrations/20251010184626_ArtifactGroupingsSearchVectorColumns.Designer.cs
generated
Normal file
@@ -0,0 +1,837 @@
|
||||
// <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 NpgsqlTypes;
|
||||
using OpenArchival.DataAccess;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace OpenArchival.DataAccess.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20251010184626_ArtifactGroupingsSearchVectorColumns")]
|
||||
partial class ArtifactGroupingsSearchVectorColumns
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
|
||||
{
|
||||
b.Property<int>("ArtifactEntriesId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DefectsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ArtifactEntriesId", "DefectsId");
|
||||
|
||||
b.HasIndex("DefectsId");
|
||||
|
||||
b.ToTable("ArtifactDefectArtifactEntry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
|
||||
{
|
||||
b.Property<int>("RelatedById")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("RelatedToId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("RelatedById", "RelatedToId");
|
||||
|
||||
b.HasIndex("RelatedToId");
|
||||
|
||||
b.ToTable("ArtifactRelationships", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
|
||||
{
|
||||
b.Property<int>("ArtifactEntriesId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TagsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ArtifactEntriesId", "TagsId");
|
||||
|
||||
b.HasIndex("TagsId");
|
||||
|
||||
b.ToTable("ArtifactEntryArtifactEntryTag");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryListedName", b =>
|
||||
{
|
||||
b.Property<int>("ArtifactEntriesId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ListedNamesId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ArtifactEntriesId", "ListedNamesId");
|
||||
|
||||
b.HasIndex("ListedNamesId");
|
||||
|
||||
b.ToTable("ArtifactEntryListedName");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ApplicationUser", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PermissionLevel")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArchiveCategory", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.PrimitiveCollection<List<string>>("FieldDescriptions")
|
||||
.IsRequired()
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.PrimitiveCollection<List<string>>("FieldNames")
|
||||
.IsRequired()
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.Property<string>("FieldSeparator")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArchiveCategories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArtifactDefects");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ArtifactGroupingId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ArtifactNumber")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
|
||||
.HasColumnType("timestamp with time zone[]");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("FileTextContent")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsPubliclyVisible")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.PrimitiveCollection<List<string>>("Links")
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.Property<int>("StorageLocationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("TypeId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ArtifactGroupingId");
|
||||
|
||||
b.HasIndex("StorageLocationId");
|
||||
|
||||
b.HasIndex("TypeId");
|
||||
|
||||
b.ToTable("ArtifactEntries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArtifactEntryTags");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AllSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("AllSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "AllSearchString" });
|
||||
|
||||
b.Property<int>("CategoryId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("DefectsSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("DefectsSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "DefectsSearchString" });
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DescriptionSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("DescriptionSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "DescriptionSearchString" });
|
||||
|
||||
b.Property<string>("FilenamesSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("FilenamesSearchVector")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "FilenamesSearchString" });
|
||||
|
||||
b.Property<bool>("IsPublicallyVisible")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ListedNamesSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("ListedNamesSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "ListedNamesSearchString" });
|
||||
|
||||
b.Property<string>("TagsSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("TagsSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "TagsSearchString" });
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TitleSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("TitleSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "TitleSearchString" });
|
||||
|
||||
b.Property<int>("TypeId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AllSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("AllSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("CategoryId");
|
||||
|
||||
b.HasIndex("DefectsSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("DefectsSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("DescriptionSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("DescriptionSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("FilenamesSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("FilenamesSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("ListedNamesSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("ListedNamesSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("TagsSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("TagsSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("TitleSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("TitleSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("TypeId");
|
||||
|
||||
b.ToTable("ArtifactGroupings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Location")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArtifactStorageLocations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArtifactTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("ArtifactGroupingId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
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("ArtifactGroupingId");
|
||||
|
||||
b.HasIndex("ParentArtifactEntryId");
|
||||
|
||||
b.ToTable("ArtifactFilePaths");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArtifactAssociatedNames");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ArtifactEntriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactDefect", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("DefectsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RelatedById")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RelatedToId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ArtifactEntriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("TagsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryListedName", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ArtifactEntriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ListedName", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ListedNamesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ArtifactGrouping")
|
||||
.WithMany("ChildArtifactEntries")
|
||||
.HasForeignKey("ArtifactGroupingId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
|
||||
.WithMany("ArtifactEntries")
|
||||
.HasForeignKey("StorageLocationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
|
||||
.WithMany("ArtifactEntries")
|
||||
.HasForeignKey("TypeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ArtifactGrouping");
|
||||
|
||||
b.Navigation("StorageLocation");
|
||||
|
||||
b.Navigation("Type");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArchiveCategory", "Category")
|
||||
.WithMany()
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
|
||||
.WithMany()
|
||||
.HasForeignKey("TypeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsOne("OpenArchival.DataAccess.IdentifierFields", "IdentifierFields", b1 =>
|
||||
{
|
||||
b1.Property<int>("ArtifactGroupingId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.PrimitiveCollection<List<string>>("Values")
|
||||
.IsRequired()
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b1.HasKey("ArtifactGroupingId");
|
||||
|
||||
b1.ToTable("ArtifactGroupings");
|
||||
|
||||
b1.ToJson("IdentifierFields");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ArtifactGroupingId");
|
||||
});
|
||||
|
||||
b.Navigation("Category");
|
||||
|
||||
b.Navigation("IdentifierFields")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Type");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
|
||||
.WithMany("ChildFilePathListings")
|
||||
.HasForeignKey("ArtifactGroupingId");
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
|
||||
.WithMany("Files")
|
||||
.HasForeignKey("ParentArtifactEntryId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("ParentArtifactEntry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
|
||||
{
|
||||
b.Navigation("Files");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
|
||||
{
|
||||
b.Navigation("ChildArtifactEntries");
|
||||
|
||||
b.Navigation("ChildFilePathListings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
|
||||
{
|
||||
b.Navigation("ArtifactEntries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
|
||||
{
|
||||
b.Navigation("ArtifactEntries");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using NpgsqlTypes;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace OpenArchival.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ArtifactGroupingsSearchVectorColumns : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "AllSearchString",
|
||||
table: "ArtifactGroupings",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<NpgsqlTsVector>(
|
||||
name: "AllSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
type: "tsvector",
|
||||
nullable: true)
|
||||
.Annotation("Npgsql:TsVectorConfig", "english")
|
||||
.Annotation("Npgsql:TsVectorProperties", new[] { "AllSearchString" });
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "DefectsSearchString",
|
||||
table: "ArtifactGroupings",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<NpgsqlTsVector>(
|
||||
name: "DefectsSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
type: "tsvector",
|
||||
nullable: true)
|
||||
.Annotation("Npgsql:TsVectorConfig", "english")
|
||||
.Annotation("Npgsql:TsVectorProperties", new[] { "DefectsSearchString" });
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "DescriptionSearchString",
|
||||
table: "ArtifactGroupings",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<NpgsqlTsVector>(
|
||||
name: "DescriptionSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
type: "tsvector",
|
||||
nullable: true)
|
||||
.Annotation("Npgsql:TsVectorConfig", "english")
|
||||
.Annotation("Npgsql:TsVectorProperties", new[] { "DescriptionSearchString" });
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "FilenamesSearchString",
|
||||
table: "ArtifactGroupings",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<NpgsqlTsVector>(
|
||||
name: "FilenamesSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
type: "tsvector",
|
||||
nullable: false)
|
||||
.Annotation("Npgsql:TsVectorConfig", "english")
|
||||
.Annotation("Npgsql:TsVectorProperties", new[] { "FilenamesSearchString" });
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ListedNamesSearchString",
|
||||
table: "ArtifactGroupings",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<NpgsqlTsVector>(
|
||||
name: "ListedNamesSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
type: "tsvector",
|
||||
nullable: true)
|
||||
.Annotation("Npgsql:TsVectorConfig", "english")
|
||||
.Annotation("Npgsql:TsVectorProperties", new[] { "ListedNamesSearchString" });
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "TagsSearchString",
|
||||
table: "ArtifactGroupings",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<NpgsqlTsVector>(
|
||||
name: "TagsSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
type: "tsvector",
|
||||
nullable: true)
|
||||
.Annotation("Npgsql:TsVectorConfig", "english")
|
||||
.Annotation("Npgsql:TsVectorProperties", new[] { "TagsSearchString" });
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "TitleSearchString",
|
||||
table: "ArtifactGroupings",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<NpgsqlTsVector>(
|
||||
name: "TitleSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
type: "tsvector",
|
||||
nullable: true)
|
||||
.Annotation("Npgsql:TsVectorConfig", "english")
|
||||
.Annotation("Npgsql:TsVectorProperties", new[] { "TitleSearchString" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ArtifactGroupings_AllSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
column: "AllSearchVector")
|
||||
.Annotation("Npgsql:IndexMethod", "GIN");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ArtifactGroupings_DefectsSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
column: "DefectsSearchVector")
|
||||
.Annotation("Npgsql:IndexMethod", "GIN");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ArtifactGroupings_DescriptionSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
column: "DescriptionSearchVector")
|
||||
.Annotation("Npgsql:IndexMethod", "GIN");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ArtifactGroupings_FilenamesSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
column: "FilenamesSearchVector")
|
||||
.Annotation("Npgsql:IndexMethod", "GIN");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ArtifactGroupings_ListedNamesSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
column: "ListedNamesSearchVector")
|
||||
.Annotation("Npgsql:IndexMethod", "GIN");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ArtifactGroupings_TagsSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
column: "TagsSearchVector")
|
||||
.Annotation("Npgsql:IndexMethod", "GIN");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ArtifactGroupings_TitleSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
column: "TitleSearchVector")
|
||||
.Annotation("Npgsql:IndexMethod", "GIN");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ArtifactGroupings_AllSearchVector",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ArtifactGroupings_DefectsSearchVector",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ArtifactGroupings_DescriptionSearchVector",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ArtifactGroupings_FilenamesSearchVector",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ArtifactGroupings_ListedNamesSearchVector",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ArtifactGroupings_TagsSearchVector",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ArtifactGroupings_TitleSearchVector",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AllSearchString",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AllSearchVector",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DefectsSearchString",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DefectsSearchVector",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DescriptionSearchString",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DescriptionSearchVector",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "FilenamesSearchString",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "FilenamesSearchVector",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ListedNamesSearchString",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ListedNamesSearchVector",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TagsSearchString",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TagsSearchVector",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TitleSearchString",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TitleSearchVector",
|
||||
table: "ArtifactGroupings");
|
||||
}
|
||||
}
|
||||
}
|
||||
845
OpenArchival.DataAccess/Migrations/20251013193014_AddedFileTextContentsSearchVector.Designer.cs
generated
Normal file
845
OpenArchival.DataAccess/Migrations/20251013193014_AddedFileTextContentsSearchVector.Designer.cs
generated
Normal file
@@ -0,0 +1,845 @@
|
||||
// <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 NpgsqlTypes;
|
||||
using OpenArchival.DataAccess;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace OpenArchival.DataAccess.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20251013193014_AddedFileTextContentsSearchVector")]
|
||||
partial class AddedFileTextContentsSearchVector
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
|
||||
{
|
||||
b.Property<int>("ArtifactEntriesId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DefectsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ArtifactEntriesId", "DefectsId");
|
||||
|
||||
b.HasIndex("DefectsId");
|
||||
|
||||
b.ToTable("ArtifactDefectArtifactEntry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
|
||||
{
|
||||
b.Property<int>("RelatedById")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("RelatedToId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("RelatedById", "RelatedToId");
|
||||
|
||||
b.HasIndex("RelatedToId");
|
||||
|
||||
b.ToTable("ArtifactRelationships", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
|
||||
{
|
||||
b.Property<int>("ArtifactEntriesId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TagsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ArtifactEntriesId", "TagsId");
|
||||
|
||||
b.HasIndex("TagsId");
|
||||
|
||||
b.ToTable("ArtifactEntryArtifactEntryTag");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryListedName", b =>
|
||||
{
|
||||
b.Property<int>("ArtifactEntriesId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ListedNamesId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ArtifactEntriesId", "ListedNamesId");
|
||||
|
||||
b.HasIndex("ListedNamesId");
|
||||
|
||||
b.ToTable("ArtifactEntryListedName");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ApplicationUser", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PermissionLevel")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArchiveCategory", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.PrimitiveCollection<List<string>>("FieldDescriptions")
|
||||
.IsRequired()
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.PrimitiveCollection<List<string>>("FieldNames")
|
||||
.IsRequired()
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.Property<string>("FieldSeparator")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArchiveCategories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArtifactDefects");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ArtifactGroupingId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ArtifactNumber")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
|
||||
.HasColumnType("timestamp with time zone[]");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("FileTextContent")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsPubliclyVisible")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.PrimitiveCollection<List<string>>("Links")
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.Property<int>("StorageLocationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("TypeId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ArtifactGroupingId");
|
||||
|
||||
b.HasIndex("StorageLocationId");
|
||||
|
||||
b.HasIndex("TypeId");
|
||||
|
||||
b.ToTable("ArtifactEntries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArtifactEntryTags");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AllSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("AllSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "AllSearchString" });
|
||||
|
||||
b.Property<int>("CategoryId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("DefectsSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("DefectsSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "DefectsSearchString" });
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DescriptionSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("DescriptionSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "DescriptionSearchString" });
|
||||
|
||||
b.Property<string>("FileContentSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("FileContentSearchVector")
|
||||
.IsRequired()
|
||||
.HasColumnType("tsvector");
|
||||
|
||||
b.Property<string>("FilenamesSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("FilenamesSearchVector")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "FilenamesSearchString" });
|
||||
|
||||
b.Property<bool>("IsPublicallyVisible")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ListedNamesSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("ListedNamesSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "ListedNamesSearchString" });
|
||||
|
||||
b.Property<string>("TagsSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("TagsSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "TagsSearchString" });
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TitleSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("TitleSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "TitleSearchString" });
|
||||
|
||||
b.Property<int>("TypeId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AllSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("AllSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("CategoryId");
|
||||
|
||||
b.HasIndex("DefectsSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("DefectsSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("DescriptionSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("DescriptionSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("FilenamesSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("FilenamesSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("ListedNamesSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("ListedNamesSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("TagsSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("TagsSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("TitleSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("TitleSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("TypeId");
|
||||
|
||||
b.ToTable("ArtifactGroupings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Location")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArtifactStorageLocations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArtifactTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("ArtifactGroupingId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
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("ArtifactGroupingId");
|
||||
|
||||
b.HasIndex("ParentArtifactEntryId");
|
||||
|
||||
b.ToTable("ArtifactFilePaths");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArtifactAssociatedNames");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ArtifactEntriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactDefect", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("DefectsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RelatedById")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RelatedToId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ArtifactEntriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("TagsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryListedName", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ArtifactEntriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ListedName", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ListedNamesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ArtifactGrouping")
|
||||
.WithMany("ChildArtifactEntries")
|
||||
.HasForeignKey("ArtifactGroupingId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
|
||||
.WithMany("ArtifactEntries")
|
||||
.HasForeignKey("StorageLocationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
|
||||
.WithMany("ArtifactEntries")
|
||||
.HasForeignKey("TypeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ArtifactGrouping");
|
||||
|
||||
b.Navigation("StorageLocation");
|
||||
|
||||
b.Navigation("Type");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArchiveCategory", "Category")
|
||||
.WithMany()
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
|
||||
.WithMany()
|
||||
.HasForeignKey("TypeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsOne("OpenArchival.DataAccess.IdentifierFields", "IdentifierFields", b1 =>
|
||||
{
|
||||
b1.Property<int>("ArtifactGroupingId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.PrimitiveCollection<List<string>>("Values")
|
||||
.IsRequired()
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b1.HasKey("ArtifactGroupingId");
|
||||
|
||||
b1.ToTable("ArtifactGroupings");
|
||||
|
||||
b1.ToJson("IdentifierFields");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ArtifactGroupingId");
|
||||
});
|
||||
|
||||
b.Navigation("Category");
|
||||
|
||||
b.Navigation("IdentifierFields")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Type");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
|
||||
.WithMany("ChildFilePathListings")
|
||||
.HasForeignKey("ArtifactGroupingId");
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
|
||||
.WithMany("Files")
|
||||
.HasForeignKey("ParentArtifactEntryId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("ParentArtifactEntry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
|
||||
{
|
||||
b.Navigation("Files");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
|
||||
{
|
||||
b.Navigation("ChildArtifactEntries");
|
||||
|
||||
b.Navigation("ChildFilePathListings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
|
||||
{
|
||||
b.Navigation("ArtifactEntries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
|
||||
{
|
||||
b.Navigation("ArtifactEntries");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using NpgsqlTypes;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace OpenArchival.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddedFileTextContentsSearchVector : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "FileContentSearchString",
|
||||
table: "ArtifactGroupings",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<NpgsqlTsVector>(
|
||||
name: "FileContentSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
type: "tsvector",
|
||||
nullable: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "FileContentSearchString",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "FileContentSearchVector",
|
||||
table: "ArtifactGroupings");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,852 @@
|
||||
// <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 NpgsqlTypes;
|
||||
using OpenArchival.DataAccess;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace OpenArchival.DataAccess.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20251013193334_AddedFileTextContentsSearchVectorFixModelBuilder")]
|
||||
partial class AddedFileTextContentsSearchVectorFixModelBuilder
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
|
||||
{
|
||||
b.Property<int>("ArtifactEntriesId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DefectsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ArtifactEntriesId", "DefectsId");
|
||||
|
||||
b.HasIndex("DefectsId");
|
||||
|
||||
b.ToTable("ArtifactDefectArtifactEntry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
|
||||
{
|
||||
b.Property<int>("RelatedById")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("RelatedToId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("RelatedById", "RelatedToId");
|
||||
|
||||
b.HasIndex("RelatedToId");
|
||||
|
||||
b.ToTable("ArtifactRelationships", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
|
||||
{
|
||||
b.Property<int>("ArtifactEntriesId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TagsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ArtifactEntriesId", "TagsId");
|
||||
|
||||
b.HasIndex("TagsId");
|
||||
|
||||
b.ToTable("ArtifactEntryArtifactEntryTag");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryListedName", b =>
|
||||
{
|
||||
b.Property<int>("ArtifactEntriesId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ListedNamesId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ArtifactEntriesId", "ListedNamesId");
|
||||
|
||||
b.HasIndex("ListedNamesId");
|
||||
|
||||
b.ToTable("ArtifactEntryListedName");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ApplicationUser", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PermissionLevel")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArchiveCategory", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.PrimitiveCollection<List<string>>("FieldDescriptions")
|
||||
.IsRequired()
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.PrimitiveCollection<List<string>>("FieldNames")
|
||||
.IsRequired()
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.Property<string>("FieldSeparator")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArchiveCategories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArtifactDefects");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ArtifactGroupingId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ArtifactNumber")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
|
||||
.HasColumnType("timestamp with time zone[]");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("FileTextContent")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsPubliclyVisible")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.PrimitiveCollection<List<string>>("Links")
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.Property<int>("StorageLocationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("TypeId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ArtifactGroupingId");
|
||||
|
||||
b.HasIndex("StorageLocationId");
|
||||
|
||||
b.HasIndex("TypeId");
|
||||
|
||||
b.ToTable("ArtifactEntries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArtifactEntryTags");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AllSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("AllSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "AllSearchString" });
|
||||
|
||||
b.Property<int>("CategoryId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("DefectsSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("DefectsSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "DefectsSearchString" });
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DescriptionSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("DescriptionSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "DescriptionSearchString" });
|
||||
|
||||
b.Property<string>("FileContentSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("FileContentSearchVector")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "FileContentSearchString" });
|
||||
|
||||
b.Property<string>("FilenamesSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("FilenamesSearchVector")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "FilenamesSearchString" });
|
||||
|
||||
b.Property<bool>("IsPublicallyVisible")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ListedNamesSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("ListedNamesSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "ListedNamesSearchString" });
|
||||
|
||||
b.Property<string>("TagsSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("TagsSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "TagsSearchString" });
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TitleSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("TitleSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "TitleSearchString" });
|
||||
|
||||
b.Property<int>("TypeId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AllSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("AllSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("CategoryId");
|
||||
|
||||
b.HasIndex("DefectsSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("DefectsSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("DescriptionSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("DescriptionSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("FileContentSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("FileContentSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("FilenamesSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("FilenamesSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("ListedNamesSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("ListedNamesSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("TagsSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("TagsSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("TitleSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("TitleSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("TypeId");
|
||||
|
||||
b.ToTable("ArtifactGroupings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Location")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArtifactStorageLocations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArtifactTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("ArtifactGroupingId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
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("ArtifactGroupingId");
|
||||
|
||||
b.HasIndex("ParentArtifactEntryId");
|
||||
|
||||
b.ToTable("ArtifactFilePaths");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ArtifactAssociatedNames");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ArtifactEntriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactDefect", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("DefectsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RelatedById")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RelatedToId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ArtifactEntriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("TagsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ArtifactEntryListedName", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ArtifactEntriesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ListedName", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("ListedNamesId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ArtifactGrouping")
|
||||
.WithMany("ChildArtifactEntries")
|
||||
.HasForeignKey("ArtifactGroupingId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
|
||||
.WithMany("ArtifactEntries")
|
||||
.HasForeignKey("StorageLocationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
|
||||
.WithMany("ArtifactEntries")
|
||||
.HasForeignKey("TypeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ArtifactGrouping");
|
||||
|
||||
b.Navigation("StorageLocation");
|
||||
|
||||
b.Navigation("Type");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArchiveCategory", "Category")
|
||||
.WithMany()
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
|
||||
.WithMany()
|
||||
.HasForeignKey("TypeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsOne("OpenArchival.DataAccess.IdentifierFields", "IdentifierFields", b1 =>
|
||||
{
|
||||
b1.Property<int>("ArtifactGroupingId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.PrimitiveCollection<List<string>>("Values")
|
||||
.IsRequired()
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b1.HasKey("ArtifactGroupingId");
|
||||
|
||||
b1.ToTable("ArtifactGroupings");
|
||||
|
||||
b1.ToJson("IdentifierFields");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ArtifactGroupingId");
|
||||
});
|
||||
|
||||
b.Navigation("Category");
|
||||
|
||||
b.Navigation("IdentifierFields")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Type");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
|
||||
{
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
|
||||
.WithMany("ChildFilePathListings")
|
||||
.HasForeignKey("ArtifactGroupingId");
|
||||
|
||||
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
|
||||
.WithMany("Files")
|
||||
.HasForeignKey("ParentArtifactEntryId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("ParentArtifactEntry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
|
||||
{
|
||||
b.Navigation("Files");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
|
||||
{
|
||||
b.Navigation("ChildArtifactEntries");
|
||||
|
||||
b.Navigation("ChildFilePathListings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
|
||||
{
|
||||
b.Navigation("ArtifactEntries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
|
||||
{
|
||||
b.Navigation("ArtifactEntries");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using NpgsqlTypes;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace OpenArchival.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddedFileTextContentsSearchVectorFixModelBuilder : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<NpgsqlTsVector>(
|
||||
name: "FileContentSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
type: "tsvector",
|
||||
nullable: false,
|
||||
oldClrType: typeof(NpgsqlTsVector),
|
||||
oldType: "tsvector")
|
||||
.Annotation("Npgsql:TsVectorConfig", "english")
|
||||
.Annotation("Npgsql:TsVectorProperties", new[] { "FileContentSearchString" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ArtifactGroupings_FileContentSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
column: "FileContentSearchVector")
|
||||
.Annotation("Npgsql:IndexMethod", "GIN");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ArtifactGroupings_FileContentSearchVector",
|
||||
table: "ArtifactGroupings");
|
||||
|
||||
migrationBuilder.AlterColumn<NpgsqlTsVector>(
|
||||
name: "FileContentSearchVector",
|
||||
table: "ArtifactGroupings",
|
||||
type: "tsvector",
|
||||
nullable: false,
|
||||
oldClrType: typeof(NpgsqlTsVector),
|
||||
oldType: "tsvector")
|
||||
.OldAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.OldAnnotation("Npgsql:TsVectorProperties", new[] { "FileContentSearchString" });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using NpgsqlTypes;
|
||||
using OpenArchival.DataAccess;
|
||||
|
||||
#nullable disable
|
||||
@@ -407,26 +408,140 @@ namespace OpenArchival.DataAccess.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AllSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("AllSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "AllSearchString" });
|
||||
|
||||
b.Property<int>("CategoryId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("DefectsSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("DefectsSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "DefectsSearchString" });
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DescriptionSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("DescriptionSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "DescriptionSearchString" });
|
||||
|
||||
b.Property<string>("FileContentSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("FileContentSearchVector")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "FileContentSearchString" });
|
||||
|
||||
b.Property<string>("FilenamesSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("FilenamesSearchVector")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "FilenamesSearchString" });
|
||||
|
||||
b.Property<bool>("IsPublicallyVisible")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ListedNamesSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("ListedNamesSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "ListedNamesSearchString" });
|
||||
|
||||
b.Property<string>("TagsSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("TagsSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "TagsSearchString" });
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TitleSearchString")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<NpgsqlTsVector>("TitleSearchVector")
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("tsvector")
|
||||
.HasAnnotation("Npgsql:TsVectorConfig", "english")
|
||||
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "TitleSearchString" });
|
||||
|
||||
b.Property<int>("TypeId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AllSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("AllSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("CategoryId");
|
||||
|
||||
b.HasIndex("DefectsSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("DefectsSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("DescriptionSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("DescriptionSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("FileContentSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("FileContentSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("FilenamesSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("FilenamesSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("ListedNamesSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("ListedNamesSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("TagsSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("TagsSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("TitleSearchVector");
|
||||
|
||||
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("TitleSearchVector"), "GIN");
|
||||
|
||||
b.HasIndex("TypeId");
|
||||
|
||||
b.ToTable("ArtifactGroupings");
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
using NpgsqlTypes;
|
||||
using Persic;
|
||||
|
||||
namespace OpenArchival.DataAccess;
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using NpgsqlTypes;
|
||||
using Persic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
@@ -11,8 +13,8 @@ public class ArtifactGrouping
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? ArtifactGroupingIdentifier
|
||||
{
|
||||
public string? ArtifactGroupingIdentifier
|
||||
{
|
||||
get
|
||||
{
|
||||
return ModelHelpers.MakeIdentifier(IdentifierFields.Values, Category.FieldSeparator, null);
|
||||
@@ -36,7 +38,8 @@ public class ArtifactGrouping
|
||||
public required ArchiveCategory Category { get; set; }
|
||||
|
||||
private IdentifierFields _identifierFields;
|
||||
public required IdentifierFields IdentifierFields {
|
||||
public required IdentifierFields IdentifierFields
|
||||
{
|
||||
get => _identifierFields;
|
||||
set
|
||||
{
|
||||
@@ -45,7 +48,7 @@ public class ArtifactGrouping
|
||||
throw new ArgumentException(nameof(IdentifierFields), $"The number of field values must be equal to the field count of the {nameof(ArchiveCategory)}");
|
||||
}
|
||||
|
||||
_identifierFields = value;
|
||||
_identifierFields = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +98,7 @@ public class ArtifactGrouping
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Only yield a tag if we have not yielded it yet
|
||||
foreach (ArtifactEntryTag tag in tags)
|
||||
{
|
||||
@@ -110,4 +113,38 @@ public class ArtifactGrouping
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables searching using postgres full text search
|
||||
/// </summary>
|
||||
///
|
||||
public string AllSearchString { get; set; } = "";
|
||||
public NpgsqlTsVector? AllSearchVector { get; set; }
|
||||
|
||||
public string TagsSearchString { get; set; } = "";
|
||||
|
||||
public NpgsqlTsVector? TagsSearchVector { get; set; }
|
||||
|
||||
public string DefectsSearchString { get; set; } = "";
|
||||
|
||||
public NpgsqlTsVector? DefectsSearchVector { get; set; }
|
||||
|
||||
public string ListedNamesSearchString { get; set; } = "";
|
||||
|
||||
public NpgsqlTsVector? ListedNamesSearchVector { get; set; }
|
||||
|
||||
public string TitleSearchString { get; set; } = "";
|
||||
|
||||
public NpgsqlTsVector? TitleSearchVector { get; set; }
|
||||
|
||||
public string DescriptionSearchString { get; set; } = "";
|
||||
|
||||
public NpgsqlTsVector? DescriptionSearchVector { get; set; }
|
||||
|
||||
public string FilenamesSearchString { get; set; } = "";
|
||||
public NpgsqlTsVector FilenamesSearchVector { get; set; }
|
||||
|
||||
public string FileContentSearchString { get; set; } = "";
|
||||
|
||||
public NpgsqlTsVector FileContentSearchVector { get; set; }
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.8" />
|
||||
<PackageReference Include="Npgsql" Version="9.0.3" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
||||
<PackageReference Include="Persic.EF.Postgres" Version="2025.106.102.11" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -35,6 +35,7 @@ public class ArtifactGroupingProvider : IArtifactGroupingProvider
|
||||
.ThenInclude(e => e.ListedNames)
|
||||
.Include(g => g.ChildArtifactEntries)
|
||||
.ThenInclude(e => e.Defects)
|
||||
.Where(g => g.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
@@ -110,7 +111,7 @@ public class ArtifactGroupingProvider : IArtifactGroupingProvider
|
||||
// Check if the type exists in the database.
|
||||
var existingType = await GetUniqueTypeAsync(entry.Type);
|
||||
entry.Type = existingType;
|
||||
|
||||
|
||||
// Handle Storage Location
|
||||
// Check if the storage location exists in the database.
|
||||
var existingLocation = await context.ArtifactStorageLocations.FirstOrDefaultAsync(l => l.Location == entry.StorageLocation.Location);
|
||||
@@ -187,18 +188,27 @@ public class ArtifactGroupingProvider : IArtifactGroupingProvider
|
||||
var managedFilePaths = new List<FilePathListing>();
|
||||
foreach (var filepath in entry.Files)
|
||||
{
|
||||
// Attempt to find the file path in the database.
|
||||
var existingFilePath = await context.ArtifactFilePaths.FirstOrDefaultAsync(f => f.Path == filepath.Path);
|
||||
|
||||
if (existingFilePath != null)
|
||||
{
|
||||
// The file path already exists. Use the tracked instance.
|
||||
managedFilePaths.Add(existingFilePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The file path is new. Add it to the managed list.
|
||||
managedFilePaths.Add(filepath);
|
||||
}
|
||||
}
|
||||
|
||||
// Replace the disconnected file path objects on the entry with the managed ones.
|
||||
entry.Files = managedFilePaths;
|
||||
}
|
||||
|
||||
// Concatinate all of the text to be searchable by postgres
|
||||
grouping.GenerateSearchIndex();
|
||||
|
||||
// Add the new grouping and save changes.
|
||||
//context.ArtifactGroupings.Add(grouping);
|
||||
@@ -219,138 +229,6 @@ public class ArtifactGroupingProvider : IArtifactGroupingProvider
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
public async Task UpdateGroupingAsync(ArtifactGrouping updatedGrouping)
|
||||
{
|
||||
// The DbContext is provided externally, so we will use it as is.
|
||||
// Assuming you have an instance available, e.g., via a constructor or method parameter.
|
||||
await using var context = await _context.CreateDbContextAsync();
|
||||
|
||||
// 1. Retrieve the existing grouping object from the database, eagerly loading all related data.
|
||||
// This is crucial for correctly handling all relationships.
|
||||
var existingGrouping = await context.ArtifactGroupings
|
||||
.Include(g => g.Category)
|
||||
.Include(g => g.IdentifierFields)
|
||||
.Include(g => g.Type)
|
||||
.Include(g => g.ChildArtifactEntries)
|
||||
.ThenInclude(e => e.StorageLocation)
|
||||
.Include(g => g.ChildArtifactEntries)
|
||||
.ThenInclude(e => e.Type)
|
||||
.Include(g => g.ChildArtifactEntries)
|
||||
.ThenInclude(e => e.Files)
|
||||
.Include(g => g.ChildArtifactEntries)
|
||||
.ThenInclude(e => e.Tags)
|
||||
.Include(g => g.ChildArtifactEntries)
|
||||
.ThenInclude(e => e.ListedNames)
|
||||
.Include(g => g.ChildArtifactEntries)
|
||||
.ThenInclude(e => e.Defects)
|
||||
.Where(g => g.Id == updatedGrouping.Id)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (existingGrouping == null)
|
||||
{
|
||||
// The grouping does not exist. You may want to throw an exception or handle this case.
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. Manually copy over primitive properties.
|
||||
existingGrouping.Title = updatedGrouping.Title;
|
||||
existingGrouping.Description = updatedGrouping.Description;
|
||||
existingGrouping.IsPublicallyVisible = updatedGrouping.IsPublicallyVisible;
|
||||
existingGrouping.IdentifierFields = updatedGrouping.IdentifierFields;
|
||||
|
||||
// Handle one-to-many relationships (Type, Category).
|
||||
// Find the existing related entity and attach it to the tracked graph.
|
||||
var existingGroupingType = await context.ArtifactTypes.FirstOrDefaultAsync(t => t.Name == updatedGrouping.Type.Name);
|
||||
if (existingGroupingType != null)
|
||||
{
|
||||
existingGrouping.Type = existingGroupingType;
|
||||
}
|
||||
else
|
||||
{
|
||||
existingGrouping.Type = updatedGrouping.Type;
|
||||
}
|
||||
|
||||
// Attach the category as specified
|
||||
if (existingGrouping.Category.Name != updatedGrouping.Category.Name)
|
||||
{
|
||||
existingGrouping.Category = updatedGrouping.Category;
|
||||
context.Add(existingGrouping.Category);
|
||||
}
|
||||
|
||||
|
||||
// 3. Synchronize the ChildArtifactEntries collection.
|
||||
// First, remove any entries that were deleted in the DTO.
|
||||
var updatedEntryIds = updatedGrouping.ChildArtifactEntries.Select(e => e.Id).ToList();
|
||||
var entriesToRemove = existingGrouping.ChildArtifactEntries
|
||||
.Where(e => !updatedEntryIds.Contains(e.Id))
|
||||
.ToList();
|
||||
|
||||
foreach (var entryToRemove in entriesToRemove)
|
||||
{
|
||||
existingGrouping.ChildArtifactEntries.Remove(entryToRemove);
|
||||
}
|
||||
|
||||
// Now, loop through the updated entries to handle updates and additions.
|
||||
foreach (var updatedEntry in updatedGrouping.ChildArtifactEntries)
|
||||
{
|
||||
var existingEntry = existingGrouping.ChildArtifactEntries
|
||||
.FirstOrDefault(e => e.Id == updatedEntry.Id);
|
||||
|
||||
if (existingEntry != null)
|
||||
{
|
||||
// The entry exists, so manually update its properties.
|
||||
existingEntry.Title = updatedEntry.Title;
|
||||
existingEntry.Description = updatedEntry.Description;
|
||||
existingEntry.ArtifactNumber = updatedEntry.ArtifactNumber;
|
||||
existingEntry.IsPubliclyVisible = updatedEntry.IsPubliclyVisible;
|
||||
existingEntry.AssociatedDates = updatedEntry.AssociatedDates;
|
||||
existingEntry.FileTextContent = updatedEntry.FileTextContent;
|
||||
|
||||
// Handle one-to-many relationships (StorageLocation, Type)
|
||||
var existingLocation = await context.ArtifactStorageLocations.FirstOrDefaultAsync(l => l.Location == updatedEntry.StorageLocation.Location);
|
||||
if (existingLocation != null)
|
||||
{
|
||||
existingEntry.StorageLocation = existingLocation;
|
||||
}
|
||||
else
|
||||
{
|
||||
existingEntry.StorageLocation = updatedEntry.StorageLocation;
|
||||
context.Add(existingEntry.StorageLocation);
|
||||
}
|
||||
|
||||
var existingType = await context.ArtifactTypes.FirstOrDefaultAsync(t => t.Name == updatedEntry.Type.Name);
|
||||
if (existingType != null)
|
||||
{
|
||||
existingEntry.Type = existingType;
|
||||
}
|
||||
else
|
||||
{
|
||||
existingEntry.Type = updatedEntry.Type;
|
||||
context.Add(existingEntry.Type);
|
||||
}
|
||||
|
||||
// Synchronize many-to-many collections.
|
||||
// This is the most complex part. We need to handle adds and removals.
|
||||
|
||||
// Helper function to handle a generic collection sync.
|
||||
await SyncCollectionAsync<ArtifactEntryTag, string>(context, existingEntry.Tags, updatedEntry.Tags, t => t.Name);
|
||||
await SyncCollectionAsync<ListedName, string>(context, existingEntry.ListedNames, updatedEntry.ListedNames, n => n.Value);
|
||||
await SyncCollectionAsync<ArtifactDefect, string>(context, existingEntry.Defects, updatedEntry.Defects, d => d.Description);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The entry is new, so add it to the tracked collection.
|
||||
existingGrouping.ChildArtifactEntries.Add(updatedEntry);
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Save all changes.
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
*/
|
||||
|
||||
public async Task UpdateGroupingAsync(ArtifactGrouping updatedGrouping)
|
||||
{
|
||||
// The DbContext is provided externally, so we will use it as is.
|
||||
@@ -409,6 +287,10 @@ public class ArtifactGroupingProvider : IArtifactGroupingProvider
|
||||
context.Add(existingGrouping.Category);
|
||||
}
|
||||
|
||||
// Update top-level properties.
|
||||
existingGrouping.Title = updatedGrouping.Title;
|
||||
existingGrouping.IsPublicallyVisible = updatedGrouping.IsPublicallyVisible;
|
||||
existingGrouping.Description = updatedGrouping.Description;
|
||||
|
||||
// 3. Synchronize the ChildArtifactEntries collection.
|
||||
// First, remove any entries that were deleted in the DTO.
|
||||
@@ -461,10 +343,11 @@ public class ArtifactGroupingProvider : IArtifactGroupingProvider
|
||||
{
|
||||
// The entry is new and its children are already de-duplicated, so just add it.
|
||||
existingGrouping.ChildArtifactEntries.Add(updatedEntry);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
existingGrouping.GenerateSearchIndex();
|
||||
|
||||
// 4. Save all changes.
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
@@ -498,14 +381,14 @@ public class ArtifactGroupingProvider : IArtifactGroupingProvider
|
||||
// De-duplicate ListedNames
|
||||
var processedNames = new List<ListedName>();
|
||||
if (entry.ListedNames != null)
|
||||
{
|
||||
{
|
||||
foreach (var name in entry.ListedNames)
|
||||
{
|
||||
{
|
||||
var existingName = await context.ArtifactAssociatedNames.FirstOrDefaultAsync(n => n.Value == name.Value) ?? name;
|
||||
processedNames.Add(existingName);
|
||||
}
|
||||
entry.ListedNames = processedNames;
|
||||
}
|
||||
}
|
||||
|
||||
// De-duplicate Defects
|
||||
var processedDefects = new List<ArtifactDefect>();
|
||||
@@ -515,19 +398,19 @@ public class ArtifactGroupingProvider : IArtifactGroupingProvider
|
||||
{
|
||||
var existingDefect = await context.ArtifactDefects.FirstOrDefaultAsync(d => d.Description == defect.Description) ?? defect;
|
||||
processedDefects.Add(existingDefect);
|
||||
}
|
||||
}
|
||||
entry.Defects = processedDefects;
|
||||
}
|
||||
}
|
||||
|
||||
if (entry.Files.Any())
|
||||
{
|
||||
{
|
||||
// 1. Get the IDs from the incoming, untracked file objects.
|
||||
var inputFileIds = entry.Files.Select(f => f.Id).ToList();
|
||||
|
||||
// 2. Fetch the actual, tracked entities from the database.
|
||||
var trackedFiles = await context.ArtifactFilePaths
|
||||
.Where(dbFile => inputFileIds.Contains(dbFile.Id))
|
||||
.ToListAsync();
|
||||
.ToListAsync();
|
||||
|
||||
// 3. Replace the untracked collection with the tracked one.
|
||||
entry.Files = trackedFiles;
|
||||
@@ -557,9 +440,9 @@ public class ArtifactGroupingProvider : IArtifactGroupingProvider
|
||||
// 2. Identify keys for brand new items
|
||||
var keysToAdd = updatedKeys.Except(existingKeys).ToList();
|
||||
if (!keysToAdd.Any())
|
||||
{
|
||||
{
|
||||
return; // Nothing to add
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Batch-fetch all entities from the DB that match the new keys.
|
||||
// This is the key change to make the query translatable to SQL.
|
||||
@@ -579,7 +462,7 @@ public class ArtifactGroupingProvider : IArtifactGroupingProvider
|
||||
.Where(n => nameKeys.Contains(n.Value))
|
||||
.ToListAsync();
|
||||
existingDbItemsMap = names.ToDictionary(n => (TKey)(object)n.Value) as Dictionary<TKey, TEntity>;
|
||||
}
|
||||
}
|
||||
else if (typeof(TEntity) == typeof(ArtifactDefect))
|
||||
{
|
||||
var defectKeys = keysToAdd.Cast<string>().ToList();
|
||||
|
||||
@@ -14,12 +14,38 @@
|
||||
"Microsoft.EntityFrameworkCore.Design": "9.0.8",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.8",
|
||||
"Npgsql": "9.0.3",
|
||||
"Npgsql.EntityFrameworkCore.PostgreSQL": "9.0.4"
|
||||
"Npgsql.EntityFrameworkCore.PostgreSQL": "9.0.4",
|
||||
"Persic.EF.Postgres": "2025.106.102.11"
|
||||
},
|
||||
"runtime": {
|
||||
"OpenArchival.DataAccess.dll": {}
|
||||
}
|
||||
},
|
||||
"Confi/2024.110.108.4": {
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration": "8.0.0",
|
||||
"Microsoft.Extensions.DependencyInjection": "9.0.8"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/Confi.dll": {
|
||||
"assemblyVersion": "1.0.0.0",
|
||||
"fileVersion": "1.0.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"EFCore.NamingConventions/9.0.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.EntityFrameworkCore": "9.0.8",
|
||||
"Microsoft.EntityFrameworkCore.Relational": "9.0.8",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.8"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/EFCore.NamingConventions.dll": {
|
||||
"assemblyVersion": "9.0.0.0",
|
||||
"fileVersion": "9.0.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"EntityFramework/6.5.1": {
|
||||
"dependencies": {
|
||||
"Microsoft.CSharp": "4.7.0",
|
||||
@@ -461,6 +487,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration/8.0.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "9.0.8",
|
||||
"Microsoft.Extensions.Primitives": "9.0.8"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.Abstractions/9.0.8": {
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Primitives": "9.0.8"
|
||||
@@ -626,6 +658,32 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Persic.EF/2025.105.129.21": {
|
||||
"dependencies": {
|
||||
"Microsoft.EntityFrameworkCore": "9.0.8",
|
||||
"Microsoft.EntityFrameworkCore.Relational": "9.0.8"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net9.0/Persic.EF.dll": {
|
||||
"assemblyVersion": "1.0.0.0",
|
||||
"fileVersion": "1.0.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Persic.EF.Postgres/2025.106.102.11": {
|
||||
"dependencies": {
|
||||
"Confi": "2024.110.108.4",
|
||||
"EFCore.NamingConventions": "9.0.0",
|
||||
"Npgsql.EntityFrameworkCore.PostgreSQL": "9.0.4",
|
||||
"Persic.EF": "2025.105.129.21"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net9.0/Persic.EF.Postgres.dll": {
|
||||
"assemblyVersion": "1.0.0.0",
|
||||
"fileVersion": "1.0.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"runtime.native.System.Data.SqlClient.sni/4.7.0": {
|
||||
"dependencies": {
|
||||
"runtime.win-arm64.runtime.native.System.Data.SqlClient.sni": "4.4.0",
|
||||
@@ -860,6 +918,20 @@
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"Confi/2024.110.108.4": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-jP9p14+Y8jYk3G8upkQK1oh0bIuVh7hnFxsu4nli/jp0fwr9DLxPLAtlbtERH/J0BlBLrlSpd5yzvQsbNH/2HQ==",
|
||||
"path": "confi/2024.110.108.4",
|
||||
"hashPath": "confi.2024.110.108.4.nupkg.sha512"
|
||||
},
|
||||
"EFCore.NamingConventions/9.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-heKIYzPdEWx+Ba4xuG6jfEssW9rEi7I0lX38eoN7wo7qgg9uw7nn8UEmDQfwGEYPzSDpetCVANnDr5tqt2Asjg==",
|
||||
"path": "efcore.namingconventions/9.0.0",
|
||||
"hashPath": "efcore.namingconventions.9.0.0.nupkg.sha512"
|
||||
},
|
||||
"EntityFramework/6.5.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
@@ -1014,6 +1086,13 @@
|
||||
"path": "microsoft.extensions.caching.memory/9.0.8",
|
||||
"hashPath": "microsoft.extensions.caching.memory.9.0.8.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Extensions.Configuration/8.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-0J/9YNXTMWSZP2p2+nvl8p71zpSwokZXZuJW+VjdErkegAnFdO1XlqtA62SJtgVYHdKu3uPxJHcMR/r35HwFBA==",
|
||||
"path": "microsoft.extensions.configuration/8.0.0",
|
||||
"hashPath": "microsoft.extensions.configuration.8.0.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.Abstractions/9.0.8": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
@@ -1119,6 +1198,20 @@
|
||||
"path": "npgsql.entityframeworkcore.postgresql/9.0.4",
|
||||
"hashPath": "npgsql.entityframeworkcore.postgresql.9.0.4.nupkg.sha512"
|
||||
},
|
||||
"Persic.EF/2025.105.129.21": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-eSQWJVKPkK3wGNydGl46z3r9xUR5AGirIyHMzXqQ6qodl36Rjxy8YW5izMcmCQbDUWX5Dri7+9/R/OWbuxK/RA==",
|
||||
"path": "persic.ef/2025.105.129.21",
|
||||
"hashPath": "persic.ef.2025.105.129.21.nupkg.sha512"
|
||||
},
|
||||
"Persic.EF.Postgres/2025.106.102.11": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-2Xwq7hvSDcXmSkP3ChOPKQjlHt8T1tFX98CSmWzIjkqJy28nmctHrrrcgmURhvRqymxbHgA/+R1d2R2mBQRmEA==",
|
||||
"path": "persic.ef.postgres/2025.106.102.11",
|
||||
"hashPath": "persic.ef.postgres.2025.106.102.11.nupkg.sha512"
|
||||
},
|
||||
"runtime.native.System.Data.SqlClient.sni/4.7.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net9.0",
|
||||
"frameworks": [
|
||||
{
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "9.0.0"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.AspNetCore.App",
|
||||
"version": "9.0.0"
|
||||
}
|
||||
],
|
||||
"configProperties": {
|
||||
"System.GC.Server": true,
|
||||
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
|
||||
"System.Reflection.NullabilityInfoContext.IsSupported": true,
|
||||
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{"Version":1,"ManifestType":"Build","Endpoints":[]}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user