From 04a7b0a2bdd1cc4f7742d82651419e4da3c8d256 Mon Sep 17 00:00:00 2001
From: Paul Fisher <36332863+Dancemammal@users.noreply.github.com>
Date: Thu, 28 Sep 2023 08:31:11 +0100
Subject: [PATCH] EES 4486 (#4325)
* EES-4486 Alter Index DataImportsFileId
* EES-4486 Update Entity Model
---
...86_AlterIndexDataImportsFileId.Designer.cs | 2018 +++++++++++++++++
...301_EES4486_AlterIndexDataImportsFileId.cs | 37 +
.../ContentDbContextModelSnapshot.cs | 2 +
.../Database/ContentDbContext.cs | 5 +
4 files changed, 2062 insertions(+)
create mode 100644 src/GovUk.Education.ExploreEducationStatistics.Admin/Migrations/ContentMigrations/20230927144301_EES4486_AlterIndexDataImportsFileId.Designer.cs
create mode 100644 src/GovUk.Education.ExploreEducationStatistics.Admin/Migrations/ContentMigrations/20230927144301_EES4486_AlterIndexDataImportsFileId.cs
diff --git a/src/GovUk.Education.ExploreEducationStatistics.Admin/Migrations/ContentMigrations/20230927144301_EES4486_AlterIndexDataImportsFileId.Designer.cs b/src/GovUk.Education.ExploreEducationStatistics.Admin/Migrations/ContentMigrations/20230927144301_EES4486_AlterIndexDataImportsFileId.Designer.cs
new file mode 100644
index 00000000000..90ca5e99e9c
--- /dev/null
+++ b/src/GovUk.Education.ExploreEducationStatistics.Admin/Migrations/ContentMigrations/20230927144301_EES4486_AlterIndexDataImportsFileId.Designer.cs
@@ -0,0 +1,2018 @@
+//
+using System;
+using GovUk.Education.ExploreEducationStatistics.Content.Model.Database;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace GovUk.Education.ExploreEducationStatistics.Admin.Migrations.ContentMigrations
+{
+ [DbContext(typeof(ContentDbContext))]
+ [Migration("20230927144301_EES4486_AlterIndexDataImportsFileId")]
+ partial class EES4486_AlterIndexDataImportsFileId
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "6.0.21")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Comment", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Content")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ContentBlockId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("LegacyCreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Resolved")
+ .HasColumnType("datetime2");
+
+ b.Property("ResolvedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Updated")
+ .HasColumnType("datetime2");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ContentBlockId");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("ResolvedById");
+
+ b.ToTable("Comment");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Contact", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ContactName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ContactTelNo")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TeamEmail")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TeamName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Contacts");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.ContentBlock", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ContentSectionId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("Locked")
+ .HasColumnType("datetime2");
+
+ b.Property("LockedById")
+ .IsConcurrencyToken()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Order")
+ .HasColumnType("int");
+
+ b.Property("Type")
+ .IsRequired()
+ .HasMaxLength(25)
+ .HasColumnType("nvarchar(25)");
+
+ b.Property("Updated")
+ .HasColumnType("datetime2");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ContentSectionId");
+
+ b.HasIndex("LockedById");
+
+ b.HasIndex("Type");
+
+ b.ToTable("ContentBlock", (string)null);
+
+ b.HasDiscriminator("Type").HasValue("ContentBlock");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.ContentSection", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Caption")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Heading")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Order")
+ .HasColumnType("int");
+
+ b.Property("Type")
+ .IsRequired()
+ .HasMaxLength(25)
+ .HasColumnType("nvarchar(25)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Type");
+
+ b.ToTable("ContentSections");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.DataImport", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("ExpectedImportedRows")
+ .HasColumnType("int");
+
+ b.Property("FileId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("GeographicLevels")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ImportedRows")
+ .HasColumnType("int");
+
+ b.Property("LastProcessedRowIndex")
+ .HasColumnType("int");
+
+ b.Property("MetaFileId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("StagePercentageComplete")
+ .HasColumnType("int");
+
+ b.Property("Status")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SubjectId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("TotalRows")
+ .HasColumnType("int");
+
+ b.Property("ZipFileId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("FileId")
+ .IsUnique();
+
+ SqlServerIndexBuilderExtensions.IncludeProperties(b.HasIndex("FileId"), new[] { "Status" });
+
+ b.HasIndex("MetaFileId")
+ .IsUnique();
+
+ b.HasIndex("ZipFileId")
+ .IsUnique()
+ .HasFilter("[ZipFileId] IS NOT NULL");
+
+ b.ToTable("DataImports");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.DataImportError", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("DataImportId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Message")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DataImportId");
+
+ b.ToTable("DataImportErrors");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.EmbedBlock", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Updated")
+ .HasColumnType("datetime2");
+
+ b.Property("Url")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("EmbedBlocks");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.FeaturedTable", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DataBlockId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Order")
+ .HasColumnType("int");
+
+ b.Property("ReleaseId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Updated")
+ .HasColumnType("datetime2");
+
+ b.Property("UpdatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("DataBlockId")
+ .IsUnique();
+
+ b.HasIndex("ReleaseId");
+
+ b.HasIndex("UpdatedById");
+
+ b.ToTable("FeaturedTables");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.File", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ContentLength")
+ .HasColumnType("bigint");
+
+ b.Property("ContentType")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("nvarchar(255)");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Filename")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ReplacedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ReplacingId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("RootPath")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("SourceId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("SubjectId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Type")
+ .IsRequired()
+ .HasMaxLength(25)
+ .HasColumnType("nvarchar(25)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("ReplacedById")
+ .IsUnique()
+ .HasFilter("[ReplacedById] IS NOT NULL");
+
+ b.HasIndex("ReplacingId")
+ .IsUnique()
+ .HasFilter("[ReplacingId] IS NOT NULL");
+
+ b.HasIndex("SourceId");
+
+ b.HasIndex("Type");
+
+ b.ToTable("Files");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.FreeTextRank", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Rank")
+ .HasColumnType("int");
+
+ b.ToTable((string)null);
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.GlossaryEntry", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Body")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedById");
+
+ b.ToTable("GlossaryEntries");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.KeyStatistic", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("GuidanceText")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("GuidanceTitle")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Order")
+ .HasColumnType("int");
+
+ b.Property("ReleaseId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Trend")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Updated")
+ .HasColumnType("datetime2");
+
+ b.Property("UpdatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("ReleaseId");
+
+ b.HasIndex("UpdatedById");
+
+ b.ToTable("KeyStatistics");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.LegacyRelease", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Order")
+ .HasColumnType("int");
+
+ b.Property("PublicationId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Url")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("PublicationId");
+
+ b.ToTable("LegacyReleases");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Methodology", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("LatestPublishedVersionId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("OwningPublicationTitle")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LatestPublishedVersionId")
+ .IsUnique()
+ .HasFilter("[LatestPublishedVersionId] IS NOT NULL");
+
+ b.ToTable("Methodologies");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyFile", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("FileId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("MethodologyVersionId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("FileId");
+
+ b.HasIndex("MethodologyVersionId");
+
+ b.ToTable("MethodologyFiles");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyNote", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Content")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DisplayDate")
+ .HasColumnType("datetime2");
+
+ b.Property("MethodologyVersionId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Updated")
+ .HasColumnType("datetime2");
+
+ b.Property("UpdatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("MethodologyVersionId");
+
+ b.HasIndex("UpdatedById");
+
+ b.ToTable("MethodologyNotes");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyStatus", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ApprovalStatus")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("InternalReleaseNote")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MethodologyVersionId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("MethodologyVersionId");
+
+ b.ToTable("MethodologyStatus");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyVersion", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("AlternativeTitle")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("MethodologyId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("PreviousVersionId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Published")
+ .HasColumnType("datetime2");
+
+ b.Property("PublishingStrategy")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ScheduledWithReleaseId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Status")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Updated")
+ .HasColumnType("datetime2");
+
+ b.Property("Version")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("MethodologyId");
+
+ b.HasIndex("PreviousVersionId");
+
+ b.HasIndex("ScheduledWithReleaseId");
+
+ b.ToTable("MethodologyVersions");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyVersionContent", b =>
+ {
+ b.Property("MethodologyVersionId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Annexes")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Content")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("MethodologyVersionId");
+
+ b.ToTable("MethodologyVersions", (string)null);
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Permalink", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("DataSetTitle")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MigratedFromLegacy")
+ .HasColumnType("bit");
+
+ b.Property("PublicationTitle")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ReleaseId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("SubjectId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ReleaseId");
+
+ b.HasIndex("SubjectId");
+
+ b.ToTable("Permalinks");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Publication", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ContactId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("LatestPublishedReleaseId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Summary")
+ .IsRequired()
+ .HasMaxLength(160)
+ .HasColumnType("nvarchar(160)");
+
+ b.Property("SupersededById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TopicId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Updated")
+ .HasColumnType("datetime2");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ContactId");
+
+ b.HasIndex("LatestPublishedReleaseId")
+ .IsUnique()
+ .HasFilter("[LatestPublishedReleaseId] IS NOT NULL");
+
+ b.HasIndex("SupersededById");
+
+ b.HasIndex("TopicId");
+
+ b.ToTable("Publications");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.PublicationMethodology", b =>
+ {
+ b.Property("PublicationId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("MethodologyId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Owner")
+ .HasColumnType("bit");
+
+ b.HasKey("PublicationId", "MethodologyId");
+
+ b.HasIndex("MethodologyId");
+
+ b.ToTable("PublicationMethodologies");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Release", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ApprovalStatus")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("DataGuidance")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("NextReleaseDate")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("NotifiedOn")
+ .HasColumnType("datetime2");
+
+ b.Property("NotifySubscribers")
+ .HasColumnType("bit");
+
+ b.Property("PreReleaseAccessList")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PreviousVersionId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("PublicationId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("PublishScheduled")
+ .HasColumnType("datetime2");
+
+ b.Property("Published")
+ .HasColumnType("datetime2");
+
+ b.Property("RelatedInformation")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ReleaseName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Slug")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SoftDeleted")
+ .HasColumnType("bit");
+
+ b.Property("TimePeriodCoverage")
+ .IsRequired()
+ .HasMaxLength(6)
+ .HasColumnType("nvarchar(6)");
+
+ b.Property("Type")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("UpdatePublishedDate")
+ .HasColumnType("bit");
+
+ b.Property("Version")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("PublicationId");
+
+ b.HasIndex("Type");
+
+ b.HasIndex("PreviousVersionId", "Version");
+
+ b.ToTable("Releases");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.ReleaseContentBlock", b =>
+ {
+ b.Property("ReleaseId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ContentBlockId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("ReleaseId", "ContentBlockId");
+
+ b.HasIndex("ContentBlockId");
+
+ b.ToTable("ReleaseContentBlocks");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.ReleaseContentSection", b =>
+ {
+ b.Property("ReleaseId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ContentSectionId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("ReleaseId", "ContentSectionId");
+
+ b.HasIndex("ContentSectionId")
+ .IsUnique();
+
+ b.ToTable("ReleaseContentSections");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.ReleaseFile", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("FileId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Name")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Order")
+ .HasColumnType("int");
+
+ b.Property("ReleaseId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Summary")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("FileId");
+
+ b.HasIndex("ReleaseId");
+
+ b.ToTable("ReleaseFiles");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.ReleaseStatus", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ApprovalStatus")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("InternalReleaseNote")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ReleaseId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("ReleaseId");
+
+ b.ToTable("ReleaseStatus");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Theme", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Slug")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Summary")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Themes");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Topic", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Slug")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ThemeId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ThemeId");
+
+ b.ToTable("Topics");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Update", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("On")
+ .HasColumnType("datetime2");
+
+ b.Property("Reason")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ReleaseId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("ReleaseId");
+
+ b.ToTable("Update");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.User", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Email")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("FirstName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("LastName")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Users");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.UserPublicationInvite", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PublicationId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Role")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("PublicationId");
+
+ b.ToTable("UserPublicationInvites");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.UserPublicationRole", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Deleted")
+ .HasColumnType("datetime2");
+
+ b.Property("DeletedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("PublicationId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Role")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("DeletedById");
+
+ b.HasIndex("PublicationId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("UserPublicationRoles");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.UserReleaseInvite", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("EmailSent")
+ .HasColumnType("bit");
+
+ b.Property("ReleaseId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Role")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SoftDeleted")
+ .HasColumnType("bit");
+
+ b.Property("Updated")
+ .HasColumnType("datetime2");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("ReleaseId");
+
+ b.ToTable("UserReleaseInvites");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.UserReleaseRole", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Deleted")
+ .HasColumnType("datetime2");
+
+ b.Property("DeletedById")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ReleaseId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Role")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SoftDeleted")
+ .HasColumnType("bit");
+
+ b.Property("UserId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("DeletedById");
+
+ b.HasIndex("ReleaseId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("UserReleaseRoles");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.DataBlock", b =>
+ {
+ b.HasBaseType("GovUk.Education.ExploreEducationStatistics.Content.Model.ContentBlock");
+
+ b.Property("Charts")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("DataBlock_Charts");
+
+ b.Property("Heading")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("DataBlock_Heading");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Query")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("DataBlock_Query");
+
+ b.Property("Source")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Table")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("DataBlock_Table");
+
+ b.HasDiscriminator().HasValue("DataBlock");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.EmbedBlockLink", b =>
+ {
+ b.HasBaseType("GovUk.Education.ExploreEducationStatistics.Content.Model.ContentBlock");
+
+ b.Property("EmbedBlockId")
+ .HasColumnType("uniqueidentifier")
+ .HasColumnName("EmbedBlockId");
+
+ b.HasIndex("EmbedBlockId")
+ .IsUnique()
+ .HasFilter("[EmbedBlockId] IS NOT NULL");
+
+ b.HasDiscriminator().HasValue("EmbedBlockLink");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.HtmlBlock", b =>
+ {
+ b.HasBaseType("GovUk.Education.ExploreEducationStatistics.Content.Model.ContentBlock");
+
+ b.Property("Body")
+ .IsRequired()
+ .ValueGeneratedOnUpdateSometimes()
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Body");
+
+ b.HasDiscriminator().HasValue("HtmlBlock");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.KeyStatisticDataBlock", b =>
+ {
+ b.HasBaseType("GovUk.Education.ExploreEducationStatistics.Content.Model.KeyStatistic");
+
+ b.Property("DataBlockId")
+ .HasColumnType("uniqueidentifier");
+
+ b.HasIndex("DataBlockId");
+
+ b.ToTable("KeyStatisticsDataBlock", (string)null);
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.KeyStatisticText", b =>
+ {
+ b.HasBaseType("GovUk.Education.ExploreEducationStatistics.Content.Model.KeyStatistic");
+
+ b.Property("Statistic")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.ToTable("KeyStatisticsText", (string)null);
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.MarkDownBlock", b =>
+ {
+ b.HasBaseType("GovUk.Education.ExploreEducationStatistics.Content.Model.ContentBlock");
+
+ b.Property("Body")
+ .IsRequired()
+ .ValueGeneratedOnUpdateSometimes()
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Body");
+
+ b.HasDiscriminator().HasValue("MarkDownBlock");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Comment", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.ContentBlock", "ContentBlock")
+ .WithMany("Comments")
+ .HasForeignKey("ContentBlockId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "CreatedBy")
+ .WithMany()
+ .HasForeignKey("CreatedById");
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "ResolvedBy")
+ .WithMany()
+ .HasForeignKey("ResolvedById");
+
+ b.Navigation("ContentBlock");
+
+ b.Navigation("CreatedBy");
+
+ b.Navigation("ResolvedBy");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.ContentBlock", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.ContentSection", "ContentSection")
+ .WithMany("Content")
+ .HasForeignKey("ContentSectionId");
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "LockedBy")
+ .WithMany()
+ .HasForeignKey("LockedById");
+
+ b.Navigation("ContentSection");
+
+ b.Navigation("LockedBy");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.DataImport", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.File", "File")
+ .WithOne()
+ .HasForeignKey("GovUk.Education.ExploreEducationStatistics.Content.Model.DataImport", "FileId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.File", "MetaFile")
+ .WithOne()
+ .HasForeignKey("GovUk.Education.ExploreEducationStatistics.Content.Model.DataImport", "MetaFileId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.File", "ZipFile")
+ .WithOne()
+ .HasForeignKey("GovUk.Education.ExploreEducationStatistics.Content.Model.DataImport", "ZipFileId")
+ .OnDelete(DeleteBehavior.Restrict);
+
+ b.Navigation("File");
+
+ b.Navigation("MetaFile");
+
+ b.Navigation("ZipFile");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.DataImportError", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.DataImport", "DataImport")
+ .WithMany("Errors")
+ .HasForeignKey("DataImportId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("DataImport");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.FeaturedTable", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "CreatedBy")
+ .WithMany()
+ .HasForeignKey("CreatedById");
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.DataBlock", "DataBlock")
+ .WithOne()
+ .HasForeignKey("GovUk.Education.ExploreEducationStatistics.Content.Model.FeaturedTable", "DataBlockId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Release", "Release")
+ .WithMany("FeaturedTables")
+ .HasForeignKey("ReleaseId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "UpdatedBy")
+ .WithMany()
+ .HasForeignKey("UpdatedById");
+
+ b.Navigation("CreatedBy");
+
+ b.Navigation("DataBlock");
+
+ b.Navigation("Release");
+
+ b.Navigation("UpdatedBy");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.File", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "CreatedBy")
+ .WithMany()
+ .HasForeignKey("CreatedById");
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.File", "ReplacedBy")
+ .WithOne()
+ .HasForeignKey("GovUk.Education.ExploreEducationStatistics.Content.Model.File", "ReplacedById");
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.File", "Replacing")
+ .WithOne()
+ .HasForeignKey("GovUk.Education.ExploreEducationStatistics.Content.Model.File", "ReplacingId");
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.File", "Source")
+ .WithMany()
+ .HasForeignKey("SourceId");
+
+ b.Navigation("CreatedBy");
+
+ b.Navigation("ReplacedBy");
+
+ b.Navigation("Replacing");
+
+ b.Navigation("Source");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.GlossaryEntry", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "CreatedBy")
+ .WithMany()
+ .HasForeignKey("CreatedById")
+ .OnDelete(DeleteBehavior.NoAction)
+ .IsRequired();
+
+ b.Navigation("CreatedBy");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.KeyStatistic", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "CreatedBy")
+ .WithMany()
+ .HasForeignKey("CreatedById");
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Release", "Release")
+ .WithMany("KeyStatistics")
+ .HasForeignKey("ReleaseId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "UpdatedBy")
+ .WithMany()
+ .HasForeignKey("UpdatedById");
+
+ b.Navigation("CreatedBy");
+
+ b.Navigation("Release");
+
+ b.Navigation("UpdatedBy");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.LegacyRelease", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Publication", "Publication")
+ .WithMany("LegacyReleases")
+ .HasForeignKey("PublicationId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Publication");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Methodology", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyVersion", "LatestPublishedVersion")
+ .WithOne()
+ .HasForeignKey("GovUk.Education.ExploreEducationStatistics.Content.Model.Methodology", "LatestPublishedVersionId");
+
+ b.Navigation("LatestPublishedVersion");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyFile", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.File", "File")
+ .WithMany()
+ .HasForeignKey("FileId")
+ .OnDelete(DeleteBehavior.NoAction)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyVersion", "MethodologyVersion")
+ .WithMany()
+ .HasForeignKey("MethodologyVersionId")
+ .OnDelete(DeleteBehavior.NoAction)
+ .IsRequired();
+
+ b.Navigation("File");
+
+ b.Navigation("MethodologyVersion");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyNote", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "CreatedBy")
+ .WithMany()
+ .HasForeignKey("CreatedById")
+ .OnDelete(DeleteBehavior.NoAction)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyVersion", "MethodologyVersion")
+ .WithMany("Notes")
+ .HasForeignKey("MethodologyVersionId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "UpdatedBy")
+ .WithMany()
+ .HasForeignKey("UpdatedById")
+ .OnDelete(DeleteBehavior.NoAction);
+
+ b.Navigation("CreatedBy");
+
+ b.Navigation("MethodologyVersion");
+
+ b.Navigation("UpdatedBy");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyStatus", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "CreatedBy")
+ .WithMany()
+ .HasForeignKey("CreatedById")
+ .OnDelete(DeleteBehavior.NoAction);
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyVersion", "MethodologyVersion")
+ .WithMany()
+ .HasForeignKey("MethodologyVersionId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("CreatedBy");
+
+ b.Navigation("MethodologyVersion");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyVersion", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "CreatedBy")
+ .WithMany()
+ .HasForeignKey("CreatedById")
+ .OnDelete(DeleteBehavior.NoAction);
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Methodology", "Methodology")
+ .WithMany("Versions")
+ .HasForeignKey("MethodologyId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyVersion", "PreviousVersion")
+ .WithMany()
+ .HasForeignKey("PreviousVersionId");
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Release", "ScheduledWithRelease")
+ .WithMany()
+ .HasForeignKey("ScheduledWithReleaseId");
+
+ b.Navigation("CreatedBy");
+
+ b.Navigation("Methodology");
+
+ b.Navigation("PreviousVersion");
+
+ b.Navigation("ScheduledWithRelease");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyVersionContent", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyVersion", null)
+ .WithOne("MethodologyContent")
+ .HasForeignKey("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyVersionContent", "MethodologyVersionId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Publication", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Contact", "Contact")
+ .WithMany()
+ .HasForeignKey("ContactId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Release", "LatestPublishedRelease")
+ .WithOne()
+ .HasForeignKey("GovUk.Education.ExploreEducationStatistics.Content.Model.Publication", "LatestPublishedReleaseId");
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Publication", "SupersededBy")
+ .WithMany()
+ .HasForeignKey("SupersededById");
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Topic", "Topic")
+ .WithMany("Publications")
+ .HasForeignKey("TopicId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.OwnsOne("GovUk.Education.ExploreEducationStatistics.Content.Model.ExternalMethodology", "ExternalMethodology", b1 =>
+ {
+ b1.Property("PublicationId")
+ .HasColumnType("uniqueidentifier");
+
+ b1.Property("Title")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b1.Property("Url")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b1.HasKey("PublicationId");
+
+ b1.ToTable("ExternalMethodology", (string)null);
+
+ b1.WithOwner()
+ .HasForeignKey("PublicationId");
+ });
+
+ b.Navigation("Contact");
+
+ b.Navigation("ExternalMethodology");
+
+ b.Navigation("LatestPublishedRelease");
+
+ b.Navigation("SupersededBy");
+
+ b.Navigation("Topic");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.PublicationMethodology", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Methodology", "Methodology")
+ .WithMany("Publications")
+ .HasForeignKey("MethodologyId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Publication", "Publication")
+ .WithMany("Methodologies")
+ .HasForeignKey("PublicationId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Methodology");
+
+ b.Navigation("Publication");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Release", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "CreatedBy")
+ .WithMany()
+ .HasForeignKey("CreatedById")
+ .OnDelete(DeleteBehavior.NoAction)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Release", "PreviousVersion")
+ .WithMany()
+ .HasForeignKey("PreviousVersionId")
+ .OnDelete(DeleteBehavior.NoAction);
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Publication", "Publication")
+ .WithMany("Releases")
+ .HasForeignKey("PublicationId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("CreatedBy");
+
+ b.Navigation("PreviousVersion");
+
+ b.Navigation("Publication");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.ReleaseContentBlock", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.ContentBlock", "ContentBlock")
+ .WithMany()
+ .HasForeignKey("ContentBlockId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Release", "Release")
+ .WithMany("ContentBlocks")
+ .HasForeignKey("ReleaseId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("ContentBlock");
+
+ b.Navigation("Release");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.ReleaseContentSection", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.ContentSection", "ContentSection")
+ .WithOne("Release")
+ .HasForeignKey("GovUk.Education.ExploreEducationStatistics.Content.Model.ReleaseContentSection", "ContentSectionId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Release", "Release")
+ .WithMany("Content")
+ .HasForeignKey("ReleaseId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("ContentSection");
+
+ b.Navigation("Release");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.ReleaseFile", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.File", "File")
+ .WithMany()
+ .HasForeignKey("FileId")
+ .OnDelete(DeleteBehavior.NoAction)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Release", "Release")
+ .WithMany()
+ .HasForeignKey("ReleaseId")
+ .OnDelete(DeleteBehavior.NoAction)
+ .IsRequired();
+
+ b.Navigation("File");
+
+ b.Navigation("Release");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.ReleaseStatus", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "CreatedBy")
+ .WithMany()
+ .HasForeignKey("CreatedById")
+ .OnDelete(DeleteBehavior.NoAction);
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Release", "Release")
+ .WithMany("ReleaseStatuses")
+ .HasForeignKey("ReleaseId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("CreatedBy");
+
+ b.Navigation("Release");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Topic", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Theme", "Theme")
+ .WithMany("Topics")
+ .HasForeignKey("ThemeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Theme");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Update", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "CreatedBy")
+ .WithMany()
+ .HasForeignKey("CreatedById");
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Release", "Release")
+ .WithMany("Updates")
+ .HasForeignKey("ReleaseId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("CreatedBy");
+
+ b.Navigation("Release");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.UserPublicationInvite", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "CreatedBy")
+ .WithMany()
+ .HasForeignKey("CreatedById")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Publication", "Publication")
+ .WithMany()
+ .HasForeignKey("PublicationId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("CreatedBy");
+
+ b.Navigation("Publication");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.UserPublicationRole", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "CreatedBy")
+ .WithMany()
+ .HasForeignKey("CreatedById")
+ .OnDelete(DeleteBehavior.NoAction);
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "DeletedBy")
+ .WithMany()
+ .HasForeignKey("DeletedById");
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Publication", "Publication")
+ .WithMany()
+ .HasForeignKey("PublicationId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "User")
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("CreatedBy");
+
+ b.Navigation("DeletedBy");
+
+ b.Navigation("Publication");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.UserReleaseInvite", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "CreatedBy")
+ .WithMany()
+ .HasForeignKey("CreatedById")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Release", "Release")
+ .WithMany()
+ .HasForeignKey("ReleaseId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("CreatedBy");
+
+ b.Navigation("Release");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.UserReleaseRole", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "CreatedBy")
+ .WithMany()
+ .HasForeignKey("CreatedById");
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "DeletedBy")
+ .WithMany()
+ .HasForeignKey("DeletedById");
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.Release", "Release")
+ .WithMany()
+ .HasForeignKey("ReleaseId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.User", "User")
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("CreatedBy");
+
+ b.Navigation("DeletedBy");
+
+ b.Navigation("Release");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.EmbedBlockLink", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.EmbedBlock", "EmbedBlock")
+ .WithOne()
+ .HasForeignKey("GovUk.Education.ExploreEducationStatistics.Content.Model.EmbedBlockLink", "EmbedBlockId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("EmbedBlock");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.KeyStatisticDataBlock", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.DataBlock", "DataBlock")
+ .WithMany()
+ .HasForeignKey("DataBlockId")
+ .OnDelete(DeleteBehavior.NoAction)
+ .IsRequired();
+
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.KeyStatistic", null)
+ .WithOne()
+ .HasForeignKey("GovUk.Education.ExploreEducationStatistics.Content.Model.KeyStatisticDataBlock", "Id")
+ .OnDelete(DeleteBehavior.ClientCascade)
+ .IsRequired();
+
+ b.Navigation("DataBlock");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.KeyStatisticText", b =>
+ {
+ b.HasOne("GovUk.Education.ExploreEducationStatistics.Content.Model.KeyStatistic", null)
+ .WithOne()
+ .HasForeignKey("GovUk.Education.ExploreEducationStatistics.Content.Model.KeyStatisticText", "Id")
+ .OnDelete(DeleteBehavior.ClientCascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.ContentBlock", b =>
+ {
+ b.Navigation("Comments");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.ContentSection", b =>
+ {
+ b.Navigation("Content");
+
+ b.Navigation("Release");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.DataImport", b =>
+ {
+ b.Navigation("Errors");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Methodology", b =>
+ {
+ b.Navigation("Publications");
+
+ b.Navigation("Versions");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.MethodologyVersion", b =>
+ {
+ b.Navigation("MethodologyContent")
+ .IsRequired();
+
+ b.Navigation("Notes");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Publication", b =>
+ {
+ b.Navigation("LegacyReleases");
+
+ b.Navigation("Methodologies");
+
+ b.Navigation("Releases");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Release", b =>
+ {
+ b.Navigation("Content");
+
+ b.Navigation("ContentBlocks");
+
+ b.Navigation("FeaturedTables");
+
+ b.Navigation("KeyStatistics");
+
+ b.Navigation("ReleaseStatuses");
+
+ b.Navigation("Updates");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Theme", b =>
+ {
+ b.Navigation("Topics");
+ });
+
+ modelBuilder.Entity("GovUk.Education.ExploreEducationStatistics.Content.Model.Topic", b =>
+ {
+ b.Navigation("Publications");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/src/GovUk.Education.ExploreEducationStatistics.Admin/Migrations/ContentMigrations/20230927144301_EES4486_AlterIndexDataImportsFileId.cs b/src/GovUk.Education.ExploreEducationStatistics.Admin/Migrations/ContentMigrations/20230927144301_EES4486_AlterIndexDataImportsFileId.cs
new file mode 100644
index 00000000000..828c21d57fc
--- /dev/null
+++ b/src/GovUk.Education.ExploreEducationStatistics.Admin/Migrations/ContentMigrations/20230927144301_EES4486_AlterIndexDataImportsFileId.cs
@@ -0,0 +1,37 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace GovUk.Education.ExploreEducationStatistics.Admin.Migrations.ContentMigrations
+{
+ public partial class EES4486_AlterIndexDataImportsFileId : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropIndex(
+ name: "IX_DataImports_FileId",
+ table: "DataImports");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_DataImports_FileId",
+ table: "DataImports",
+ column: "FileId",
+ unique: true)
+ .Annotation("SqlServer:Include", new[] { "Status" });
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropIndex(
+ name: "IX_DataImports_FileId",
+ table: "DataImports");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_DataImports_FileId",
+ table: "DataImports",
+ column: "FileId",
+ unique: true);
+ }
+ }
+}
diff --git a/src/GovUk.Education.ExploreEducationStatistics.Admin/Migrations/ContentMigrations/ContentDbContextModelSnapshot.cs b/src/GovUk.Education.ExploreEducationStatistics.Admin/Migrations/ContentMigrations/ContentDbContextModelSnapshot.cs
index 74e233d709e..1a82a6b0285 100644
--- a/src/GovUk.Education.ExploreEducationStatistics.Admin/Migrations/ContentMigrations/ContentDbContextModelSnapshot.cs
+++ b/src/GovUk.Education.ExploreEducationStatistics.Admin/Migrations/ContentMigrations/ContentDbContextModelSnapshot.cs
@@ -210,6 +210,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.HasIndex("FileId")
.IsUnique();
+ SqlServerIndexBuilderExtensions.IncludeProperties(b.HasIndex("FileId"), new[] { "Status" });
+
b.HasIndex("MetaFileId")
.IsUnique();
diff --git a/src/GovUk.Education.ExploreEducationStatistics.Content.Model/Database/ContentDbContext.cs b/src/GovUk.Education.ExploreEducationStatistics.Content.Model/Database/ContentDbContext.cs
index 9c4017bfae5..2707449cf9f 100644
--- a/src/GovUk.Education.ExploreEducationStatistics.Content.Model/Database/ContentDbContext.cs
+++ b/src/GovUk.Education.ExploreEducationStatistics.Content.Model/Database/ContentDbContext.cs
@@ -108,6 +108,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.WithOne()
.OnDelete(DeleteBehavior.Restrict);
+ modelBuilder.Entity()
+ .HasIndex(import => import.FileId)
+ .IncludeProperties(
+ import => new { import.Status });
+
modelBuilder.Entity()
.HasOne(import => import.MetaFile)
.WithOne()