diff --git a/Dfe.Academies.Api.Infrastructure/Dfe.Academies.Infrastructure.csproj b/Dfe.Academies.Api.Infrastructure/Dfe.Academies.Infrastructure.csproj
index a7cfc8198..614e0db44 100644
--- a/Dfe.Academies.Api.Infrastructure/Dfe.Academies.Infrastructure.csproj
+++ b/Dfe.Academies.Api.Infrastructure/Dfe.Academies.Infrastructure.csproj
@@ -21,4 +21,8 @@
+
+
+
+
diff --git a/Dfe.Academies.Api.Infrastructure/Migrations/20231218095513_Initial.Designer.cs b/Dfe.Academies.Api.Infrastructure/Migrations/20231218095513_Initial.Designer.cs
new file mode 100644
index 000000000..0331cbe5c
--- /dev/null
+++ b/Dfe.Academies.Api.Infrastructure/Migrations/20231218095513_Initial.Designer.cs
@@ -0,0 +1,768 @@
+//
+using System;
+using Dfe.Academies.Academisation.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace Dfe.Academies.Infrastructure.Migrations
+{
+ [DbContext(typeof(MstrContext))]
+ [Migration("20231218095513_Initial")]
+ partial class Initial
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "6.0.25")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
+
+ modelBuilder.Entity("Dfe.Academies.Domain.Establishment.EducationEstablishmentTrust", b =>
+ {
+ b.Property("SK")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("SK"), 1L, 1);
+
+ b.Property("EducationEstablishmentId")
+ .HasColumnType("int")
+ .HasColumnName("FK_EducationEstablishment");
+
+ b.Property("TrustId")
+ .HasColumnType("int")
+ .HasColumnName("FK_Trust");
+
+ b.HasKey("SK");
+
+ b.ToTable("EducationEstablishmentTrust", "mstr");
+ });
+
+ modelBuilder.Entity("Dfe.Academies.Domain.Establishment.Establishment", b =>
+ {
+ b.Property("SK")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("SK"), 1L, 1);
+
+ b.Property("AddressLine1")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Address Line1");
+
+ b.Property("AddressLine2")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Address Line2");
+
+ b.Property("AddressLine3")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Address Line3");
+
+ b.Property("AdministrativeDistrict")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Administrative District");
+
+ b.Property("BehaviourAndAttitudes")
+ .HasColumnType("int")
+ .HasColumnName("Behaviour and attitudes");
+
+ b.Property("CategoryOfConcern")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Category of concern");
+
+ b.Property("CloseDate")
+ .HasColumnType("datetime2")
+ .HasColumnName("CloseDate");
+
+ b.Property("County")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("County");
+
+ b.Property("DateOfLatestShortInspection")
+ .HasColumnType("datetime2")
+ .HasColumnName("Date of latest short inspection");
+
+ b.Property("DidTheLatestShortInspectionConvertToAFullInspection")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Did the latest short inspection convert to a full inspection?");
+
+ b.Property("Diocese")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Diocese");
+
+ b.Property("DioceseCode")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Diocese(code)");
+
+ b.Property("EarlyYearsProvisionWhereApplicable")
+ .HasColumnType("int")
+ .HasColumnName("Early years provision (where applicable)");
+
+ b.Property("EffectivenessOfLeadershipAndManagement")
+ .HasColumnType("int")
+ .HasColumnName("Effectiveness of leadership and management");
+
+ b.Property("Email")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Email");
+
+ b.Property("EstablishmentGroupTypeId")
+ .HasColumnType("bigint")
+ .HasColumnName("FK_EstablishmentGroupType");
+
+ b.Property("EstablishmentName")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("EstablishmentName");
+
+ b.Property("EstablishmentNumber")
+ .HasColumnType("int")
+ .HasColumnName("EstablishmentNumber");
+
+ b.Property("EstablishmentStatusId")
+ .HasColumnType("bigint")
+ .HasColumnName("FK_EstablishmentStatus");
+
+ b.Property("EstablishmentTypeId")
+ .HasColumnType("bigint")
+ .HasColumnName("FK_EstablishmentType");
+
+ b.Property("GORregion")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("GORregion");
+
+ b.Property("GORregionCode")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("GORregion(code)");
+
+ b.Property("GiasLastChangedDate")
+ .HasColumnType("datetime2");
+
+ b.Property("HeadFirstName")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("HeadFirstName");
+
+ b.Property("HeadLastName")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("HeadLastName");
+
+ b.Property("HeadPreferredJobTitle")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("HeadPreferredJobTitle");
+
+ b.Property("HeadTitle")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("HeadTitle");
+
+ b.Property("IfdPipelineSK")
+ .HasColumnType("bigint");
+
+ b.Property("InspectionEndDate")
+ .HasColumnType("datetime2")
+ .HasColumnName("Inspection end date");
+
+ b.Property("InspectionStartDate")
+ .HasColumnType("datetime2")
+ .HasColumnName("Inspection start date");
+
+ b.Property("InspectionType")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Inspection type");
+
+ b.Property("IsSafeguardingEffective")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Is safeguarding effective?");
+
+ b.Property("Latitude")
+ .HasColumnType("float")
+ .HasColumnName("Latitude");
+
+ b.Property("LocalAuthorityId")
+ .HasColumnType("bigint")
+ .HasColumnName("FK_LocalAuthority");
+
+ b.Property("Longitude")
+ .HasColumnType("float")
+ .HasColumnName("Longitude");
+
+ b.Property("MainPhone")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Main Phone");
+
+ b.Property("Modified")
+ .HasColumnType("datetime2")
+ .HasColumnName("Modified");
+
+ b.Property("ModifiedBy")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Modified By");
+
+ b.Property("NumberOfBoys")
+ .HasColumnType("int");
+
+ b.Property("NumberOfGirls")
+ .HasColumnType("int");
+
+ b.Property("NumberOfOtherSection8InspectionsSinceLastFullInspection")
+ .HasColumnType("int")
+ .HasColumnName("Number of other section 8 inspections since last full inspection");
+
+ b.Property("NumberOfPupils")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("NumberOfPupils");
+
+ b.Property("NumberOfShortInspectionsSinceLastFullInspection")
+ .HasColumnType("int")
+ .HasColumnName("Number of short inspections since last full inspection");
+
+ b.Property("OfstedLastInspection")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("OfstedLastInspection");
+
+ b.Property("OfstedRating")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("OfstedRating");
+
+ b.Property("OpenDate")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("OpenDate");
+
+ b.Property("OverallEffectiveness")
+ .HasColumnType("int")
+ .HasColumnName("Overall effectiveness");
+
+ b.Property("PK_CDM_ID")
+ .HasColumnType("bigint")
+ .HasColumnName("PK_CDM_ID");
+
+ b.Property("PK_GIAS_URN")
+ .HasColumnType("int")
+ .HasColumnName("PK_GIAS_URN");
+
+ b.Property("ParliamentaryConstituency")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Parliamentary constituency");
+
+ b.Property("ParliamentaryConstituencyCode")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ParliamentaryConstituency(code)");
+
+ b.Property("PercentageFSM")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("PercentageFSM");
+
+ b.Property("PersonalDevelopment")
+ .HasColumnType("int")
+ .HasColumnName("Personal development");
+
+ b.Property("PhaseOfEducation")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("PhaseOfEducation");
+
+ b.Property("PhaseOfEducationCode")
+ .HasColumnType("int")
+ .HasColumnName("PhaseOfEducation(code)");
+
+ b.Property("Postcode")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Postcode");
+
+ b.Property("PreviousCategoryOfConcern")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Previous category of concern");
+
+ b.Property("PreviousEarlyYearsProvisionWhereApplicable")
+ .HasColumnType("int")
+ .HasColumnName("Previous early years provision (where applicable)");
+
+ b.Property("PreviousFullInspectionOverallEffectiveness")
+ .HasColumnType("int")
+ .HasColumnName("Previous full inspection overall effectiveness");
+
+ b.Property("PreviousInspectionEndDate")
+ .HasColumnType("datetime2")
+ .HasColumnName("Previous inspection end date");
+
+ b.Property("PreviousInspectionStartDate")
+ .HasColumnType("datetime2")
+ .HasColumnName("Previous inspection start date");
+
+ b.Property("PreviousIsSafeguardingEffective")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Previous is safeguarding effective?");
+
+ b.Property("PreviousPublicationDate")
+ .HasColumnType("datetime2")
+ .HasColumnName("Previous publication date");
+
+ b.Property("ProjectLead")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Project Lead");
+
+ b.Property("PublicationDate")
+ .HasColumnType("datetime2")
+ .HasColumnName("Publication date");
+
+ b.Property("QualityOfEducation")
+ .HasColumnType("int")
+ .HasColumnName("Quality of education");
+
+ b.Property("ReasonEstablishmentClosed")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ReasonEstablishmentClosed");
+
+ b.Property("RegionId")
+ .HasColumnType("bigint")
+ .HasColumnName("FK_Region");
+
+ b.Property("ReligiousCharacter")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ReligiousCharacter");
+
+ b.Property("ReligiousCharacterCode")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ReligiousCharacter(code)");
+
+ b.Property("ReligiousEthos")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("ReligiousEthos");
+
+ b.Property("RouteOfProject")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Route of Project");
+
+ b.Property("SFSOTerritory")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("SFSO Territory");
+
+ b.Property("SchoolCapacity")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("SchoolCapacity");
+
+ b.Property("SenUnitCapacity")
+ .HasColumnType("int");
+
+ b.Property("SenUnitOnRoll")
+ .HasColumnType("int");
+
+ b.Property("ShortInspectionOverallOutcome")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Short inspection overall outcome");
+
+ b.Property("ShortInspectionPublicationDate")
+ .HasColumnType("datetime2")
+ .HasColumnName("Short inspection publication date");
+
+ b.Property("SixthFormProvisionWhereApplicable")
+ .HasColumnType("int")
+ .HasColumnName("Sixth form provision (where applicable)");
+
+ b.Property("StatutoryHighAge")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("StatutoryHighAge");
+
+ b.Property("StatutoryLowAge")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("StatutoryLowAge");
+
+ b.Property("TheIncomeDeprivationAffectingChildrenIndexIDACIQuintile")
+ .HasColumnType("int")
+ .HasColumnName("The income deprivation affecting children index (IDACI) quintile");
+
+ b.Property("Town")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Town");
+
+ b.Property("UKPRN")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("UKPRN");
+
+ b.Property("URN")
+ .HasColumnType("int")
+ .HasColumnName("URN");
+
+ b.Property("URNAtCurrentFullInspection")
+ .HasColumnType("int")
+ .HasColumnName("URN at Current full inspection");
+
+ b.Property("URNAtPreviousFullInspection")
+ .HasColumnType("int")
+ .HasColumnName("URN at Previous full inspection");
+
+ b.Property("URNAtSection8Inspection")
+ .HasColumnType("int")
+ .HasColumnName("URN at Section 8 inspection");
+
+ b.Property("Website")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Website");
+
+ b.HasKey("SK");
+
+ b.HasIndex("EstablishmentTypeId");
+
+ b.HasIndex("IfdPipelineSK");
+
+ b.HasIndex("LocalAuthorityId");
+
+ b.ToTable("EducationEstablishment", "mstr");
+ });
+
+ modelBuilder.Entity("Dfe.Academies.Domain.Establishment.EstablishmentType", b =>
+ {
+ b.Property("SK")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("SK"), 1L, 1);
+
+ b.Property("Code")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("SK");
+
+ b.ToTable("Ref_EducationEstablishmentType", "mstr");
+
+ b.HasData(
+ new
+ {
+ SK = 224L,
+ Code = "35",
+ Name = "Free schools"
+ },
+ new
+ {
+ SK = 228L,
+ Code = "18",
+ Name = "Further education"
+ });
+ });
+
+ modelBuilder.Entity("Dfe.Academies.Domain.Establishment.IfdPipeline", b =>
+ {
+ b.Property("SK")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("SK"), 1L, 1);
+
+ b.Property("DeliveryProcessPAN")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Delivery Process.PAN");
+
+ b.Property("DeliveryProcessPFI")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Delivery Process.PFI");
+
+ b.Property("GeneralDetailsUrn")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("General Details.URN");
+
+ b.Property("ProjectTemplateInformationDeficit")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Project template information.Deficit?");
+
+ b.Property("ProjectTemplateInformationViabilityIssue")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Project template information.Viability issue?");
+
+ b.HasKey("SK");
+
+ b.ToTable("IfdPipeline", "mstr");
+ });
+
+ modelBuilder.Entity("Dfe.Academies.Domain.Establishment.LocalAuthority", b =>
+ {
+ b.Property("SK")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("SK"), 1L, 1);
+
+ b.Property("Code")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("SK");
+
+ b.ToTable("Ref_LocalAuthority", "mstr");
+
+ b.HasData(
+ new
+ {
+ SK = 1L,
+ Code = "202",
+ Name = "Barnsley"
+ },
+ new
+ {
+ SK = 2L,
+ Code = "203",
+ Name = "Birmingham"
+ },
+ new
+ {
+ SK = 3L,
+ Code = "204",
+ Name = "Bradford"
+ });
+ });
+
+ modelBuilder.Entity("Dfe.Academies.Domain.Trust.Trust", b =>
+ {
+ b.Property("SK")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("SK"), 1L, 1);
+
+ b.Property("AMSDTerritory")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("AMSD Territory");
+
+ b.Property("AddressLine1")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Address Line1");
+
+ b.Property("AddressLine2")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Address Line2");
+
+ b.Property("AddressLine3")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Address Line3");
+
+ b.Property("ClosedDate")
+ .HasColumnType("datetime2")
+ .HasColumnName("Closed Date");
+
+ b.Property("CompaniesHouseNumber")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Companies House Number");
+
+ b.Property("County")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("County");
+
+ b.Property("CurrentSingleListGrouping")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Current Single List Grouping");
+
+ b.Property("DateActionPlannedFor")
+ .HasColumnType("datetime2")
+ .HasColumnName("Date Action Planned For");
+
+ b.Property("DateEnteredOntoSingleList")
+ .HasColumnType("datetime2")
+ .HasColumnName("Date Entered Onto Single List");
+
+ b.Property("DateOfGroupingDecision")
+ .HasColumnType("datetime2")
+ .HasColumnName("Date of Grouping Decision");
+
+ b.Property("DateOfTrustReviewMeeting")
+ .HasColumnType("datetime2")
+ .HasColumnName("Date of Trust Review Meeting");
+
+ b.Property("EfficiencyICFPReviewCompleted")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Efficiency ICFP Review Completed");
+
+ b.Property("EfficiencyICFPReviewOther")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Efficiency ICFP Review Other");
+
+ b.Property("ExternalGovernanceReviewDate")
+ .HasColumnType("datetime2")
+ .HasColumnName("External Governance Review Date");
+
+ b.Property("FollowUpLetterSent")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Follow Up Letter Sent");
+
+ b.Property("GroupID")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Group ID");
+
+ b.Property("GroupUID")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Group UID");
+
+ b.Property("IncorporatedOnOpenDate")
+ .HasColumnType("datetime2")
+ .HasColumnName("Incorporated on (open date)");
+
+ b.Property("JoinedDate")
+ .HasColumnType("datetime2")
+ .HasColumnName("Joined Date");
+
+ b.Property("LeadAMSDTerritory")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Lead AMSD Territory");
+
+ b.Property("LinkToWorkplaceForEfficiencyICFPReview")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Link To Workplace For Efficiency ICFP Review");
+
+ b.Property("MainPhone")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Main Phone");
+
+ b.Property("Modified")
+ .HasColumnType("datetime2")
+ .HasColumnName("Modified");
+
+ b.Property("ModifiedBy")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Modified By");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Name");
+
+ b.Property("NumberInTrust")
+ .HasColumnType("int")
+ .HasColumnName("Number In Trust");
+
+ b.Property("Postcode")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Postcode");
+
+ b.Property("PrioritisedForReview")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Prioritised for Review");
+
+ b.Property("RID")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("RID");
+
+ b.Property("RegionId")
+ .HasColumnType("bigint")
+ .HasColumnName("FK_Region");
+
+ b.Property("Town")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Town");
+
+ b.Property("TrustBandingId")
+ .HasColumnType("bigint")
+ .HasColumnName("FK_TrustBanding");
+
+ b.Property("TrustPerformanceAndRiskDateOfMeeting")
+ .HasColumnType("datetime2")
+ .HasColumnName("Trust Performance And Risk Date Of Meeting");
+
+ b.Property("TrustReviewWriteUp")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Trust Review Write Up");
+
+ b.Property("TrustStatus")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("Trust Status");
+
+ b.Property("TrustStatusId")
+ .HasColumnType("bigint")
+ .HasColumnName("FK_TrustStatus");
+
+ b.Property("TrustTypeId")
+ .HasColumnType("bigint")
+ .HasColumnName("FK_TrustType");
+
+ b.Property("UKPRN")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("UKPRN");
+
+ b.Property("UPIN")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("UPIN");
+
+ b.Property("WIPSummaryGoesToMinister")
+ .HasColumnType("nvarchar(max)")
+ .HasColumnName("WIP Summary Goes To Minister");
+
+ b.HasKey("SK");
+
+ b.HasIndex("TrustTypeId");
+
+ b.ToTable("Trust", "mstr");
+ });
+
+ modelBuilder.Entity("Dfe.Academies.Domain.Trust.TrustType", b =>
+ {
+ b.Property("SK")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("SK"), 1L, 1);
+
+ b.Property("Code")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("SK");
+
+ b.ToTable("Ref_TrustType", "mstr");
+
+ b.HasData(
+ new
+ {
+ SK = 30L,
+ Code = "06",
+ Name = "Multi-academy trust"
+ },
+ new
+ {
+ SK = 32L,
+ Code = "10",
+ Name = "Single-academy trust"
+ });
+ });
+
+ modelBuilder.Entity("Dfe.Academies.Domain.Establishment.Establishment", b =>
+ {
+ b.HasOne("Dfe.Academies.Domain.Establishment.EstablishmentType", "EstablishmentType")
+ .WithMany()
+ .HasForeignKey("EstablishmentTypeId");
+
+ b.HasOne("Dfe.Academies.Domain.Establishment.IfdPipeline", "IfdPipeline")
+ .WithMany()
+ .HasForeignKey("IfdPipelineSK");
+
+ b.HasOne("Dfe.Academies.Domain.Establishment.LocalAuthority", "LocalAuthority")
+ .WithMany()
+ .HasForeignKey("LocalAuthorityId");
+
+ b.Navigation("EstablishmentType");
+
+ b.Navigation("IfdPipeline");
+
+ b.Navigation("LocalAuthority");
+ });
+
+ modelBuilder.Entity("Dfe.Academies.Domain.Trust.Trust", b =>
+ {
+ b.HasOne("Dfe.Academies.Domain.Trust.TrustType", "TrustType")
+ .WithMany()
+ .HasForeignKey("TrustTypeId");
+
+ b.Navigation("TrustType");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Dfe.Academies.Api.Infrastructure/Migrations/20231218095513_Initial.cs b/Dfe.Academies.Api.Infrastructure/Migrations/20231218095513_Initial.cs
new file mode 100644
index 000000000..4898806fb
--- /dev/null
+++ b/Dfe.Academies.Api.Infrastructure/Migrations/20231218095513_Initial.cs
@@ -0,0 +1,360 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Dfe.Academies.Infrastructure.Migrations
+{
+ public partial class Initial : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.EnsureSchema(
+ name: "mstr");
+
+ migrationBuilder.CreateTable(
+ name: "EducationEstablishmentTrust",
+ schema: "mstr",
+ columns: table => new
+ {
+ SK = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ FK_Trust = table.Column(type: "int", nullable: false),
+ FK_EducationEstablishment = table.Column(type: "int", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_EducationEstablishmentTrust", x => x.SK);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "IfdPipeline",
+ schema: "mstr",
+ columns: table => new
+ {
+ SK = table.Column(type: "bigint", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ GeneralDetailsURN = table.Column(name: "General Details.URN", type: "nvarchar(max)", nullable: true),
+ DeliveryProcessPFI = table.Column(name: "Delivery Process.PFI", type: "nvarchar(max)", nullable: true),
+ DeliveryProcessPAN = table.Column(name: "Delivery Process.PAN", type: "nvarchar(max)", nullable: true),
+ ProjecttemplateinformationDeficit = table.Column(name: "Project template information.Deficit?", type: "nvarchar(max)", nullable: true),
+ ProjecttemplateinformationViabilityissue = table.Column(name: "Project template information.Viability issue?", type: "nvarchar(max)", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_IfdPipeline", x => x.SK);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Ref_EducationEstablishmentType",
+ schema: "mstr",
+ columns: table => new
+ {
+ SK = table.Column(type: "bigint", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Name = table.Column(type: "nvarchar(max)", nullable: true),
+ Code = table.Column(type: "nvarchar(max)", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Ref_EducationEstablishmentType", x => x.SK);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Ref_LocalAuthority",
+ schema: "mstr",
+ columns: table => new
+ {
+ SK = table.Column(type: "bigint", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Name = table.Column(type: "nvarchar(max)", nullable: true),
+ Code = table.Column(type: "nvarchar(max)", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Ref_LocalAuthority", x => x.SK);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Ref_TrustType",
+ schema: "mstr",
+ columns: table => new
+ {
+ SK = table.Column(type: "bigint", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Name = table.Column(type: "nvarchar(max)", nullable: true),
+ Code = table.Column(type: "nvarchar(max)", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Ref_TrustType", x => x.SK);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "EducationEstablishment",
+ schema: "mstr",
+ columns: table => new
+ {
+ SK = table.Column(type: "bigint", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ PK_GIAS_URN = table.Column(type: "int", nullable: true),
+ PK_CDM_ID = table.Column(type: "bigint", nullable: true),
+ URN = table.Column(type: "int", nullable: true),
+ FK_LocalAuthority = table.Column(type: "bigint", nullable: true),
+ FK_EstablishmentType = table.Column(type: "bigint", nullable: true),
+ FK_EstablishmentGroupType = table.Column(type: "bigint", nullable: true),
+ FK_EstablishmentStatus = table.Column(type: "bigint", nullable: true),
+ FK_Region = table.Column(type: "bigint", nullable: true),
+ EstablishmentNumber = table.Column(type: "int", nullable: true),
+ EstablishmentName = table.Column(type: "nvarchar(max)", nullable: true),
+ Latitude = table.Column(type: "float", nullable: true),
+ Longitude = table.Column(type: "float", nullable: true),
+ MainPhone = table.Column(name: "Main Phone", type: "nvarchar(max)", nullable: true),
+ AddressLine1 = table.Column(name: "Address Line1", type: "nvarchar(max)", nullable: true),
+ AddressLine2 = table.Column(name: "Address Line2", type: "nvarchar(max)", nullable: true),
+ AddressLine3 = table.Column(name: "Address Line3", type: "nvarchar(max)", nullable: true),
+ Town = table.Column(type: "nvarchar(max)", nullable: true),
+ County = table.Column(type: "nvarchar(max)", nullable: true),
+ Postcode = table.Column(type: "nvarchar(max)", nullable: true),
+ Email = table.Column(type: "nvarchar(max)", nullable: true),
+ Website = table.Column(type: "nvarchar(max)", nullable: true),
+ StatutoryLowAge = table.Column(type: "nvarchar(max)", nullable: true),
+ StatutoryHighAge = table.Column(type: "nvarchar(max)", nullable: true),
+ SchoolCapacity = table.Column(type: "nvarchar(max)", nullable: true),
+ NumberOfPupils = table.Column(type: "nvarchar(max)", nullable: true),
+ OfstedLastInspection = table.Column(type: "nvarchar(max)", nullable: true),
+ OfstedRating = table.Column(type: "nvarchar(max)", nullable: true),
+ OpenDate = table.Column(type: "nvarchar(max)", nullable: true),
+ Modified = table.Column(type: "datetime2", nullable: true),
+ ModifiedBy = table.Column(name: "Modified By", type: "nvarchar(max)", nullable: true),
+ TheincomedeprivationaffectingchildrenindexIDACIquintile = table.Column(name: "The income deprivation affecting children index (IDACI) quintile", type: "int", nullable: true),
+ Numberofshortinspectionssincelastfullinspection = table.Column(name: "Number of short inspections since last full inspection", type: "int", nullable: true),
+ Dateoflatestshortinspection = table.Column(name: "Date of latest short inspection", type: "datetime2", nullable: true),
+ Shortinspectionpublicationdate = table.Column(name: "Short inspection publication date", type: "datetime2", nullable: true),
+ Didthelatestshortinspectionconverttoafullinspection = table.Column(name: "Did the latest short inspection convert to a full inspection?", type: "nvarchar(max)", nullable: true),
+ Shortinspectionoveralloutcome = table.Column(name: "Short inspection overall outcome", type: "nvarchar(max)", nullable: true),
+ Numberofothersection8inspectionssincelastfullinspection = table.Column(name: "Number of other section 8 inspections since last full inspection", type: "int", nullable: true),
+ Inspectiontype = table.Column(name: "Inspection type", type: "nvarchar(max)", nullable: true),
+ Inspectionstartdate = table.Column(name: "Inspection start date", type: "datetime2", nullable: true),
+ Inspectionenddate = table.Column(name: "Inspection end date", type: "datetime2", nullable: true),
+ Publicationdate = table.Column(name: "Publication date", type: "datetime2", nullable: true),
+ Overalleffectiveness = table.Column(name: "Overall effectiveness", type: "int", nullable: true),
+ Categoryofconcern = table.Column(name: "Category of concern", type: "nvarchar(max)", nullable: true),
+ Earlyyearsprovisionwhereapplicable = table.Column(name: "Early years provision (where applicable)", type: "int", nullable: true),
+ Effectivenessofleadershipandmanagement = table.Column(name: "Effectiveness of leadership and management", type: "int", nullable: true),
+ Issafeguardingeffective = table.Column(name: "Is safeguarding effective?", type: "nvarchar(max)", nullable: true),
+ Previousinspectionstartdate = table.Column(name: "Previous inspection start date", type: "datetime2", nullable: true),
+ Previousinspectionenddate = table.Column(name: "Previous inspection end date", type: "datetime2", nullable: true),
+ Previouspublicationdate = table.Column(name: "Previous publication date", type: "datetime2", nullable: true),
+ Previousfullinspectionoveralleffectiveness = table.Column(name: "Previous full inspection overall effectiveness", type: "int", nullable: true),
+ Previouscategoryofconcern = table.Column(name: "Previous category of concern", type: "nvarchar(max)", nullable: true),
+ Previousearlyyearsprovisionwhereapplicable = table.Column(name: "Previous early years provision (where applicable)", type: "int", nullable: true),
+ Previousissafeguardingeffective = table.Column(name: "Previous is safeguarding effective?", type: "nvarchar(max)", nullable: true),
+ HeadTitle = table.Column(type: "nvarchar(max)", nullable: true),
+ HeadFirstName = table.Column(type: "nvarchar(max)", nullable: true),
+ HeadLastName = table.Column(type: "nvarchar(max)", nullable: true),
+ HeadPreferredJobTitle = table.Column(type: "nvarchar(max)", nullable: true),
+ PhaseOfEducation = table.Column(type: "nvarchar(max)", nullable: true),
+ PercentageFSM = table.Column(type: "nvarchar(max)", nullable: true),
+ UKPRN = table.Column(type: "nvarchar(max)", nullable: true),
+ ReligiousCharacter = table.Column(type: "nvarchar(max)", nullable: true),
+ ReligiousEthos = table.Column(type: "nvarchar(max)", nullable: true),
+ Diocese = table.Column(type: "nvarchar(max)", nullable: true),
+ ReasonEstablishmentClosed = table.Column(type: "nvarchar(max)", nullable: true),
+ CloseDate = table.Column(type: "datetime2", nullable: true),
+ ProjectLead = table.Column(name: "Project Lead", type: "nvarchar(max)", nullable: true),
+ Parliamentaryconstituency = table.Column(name: "Parliamentary constituency", type: "nvarchar(max)", nullable: true),
+ Qualityofeducation = table.Column(name: "Quality of education", type: "int", nullable: true),
+ Behaviourandattitudes = table.Column(name: "Behaviour and attitudes", type: "int", nullable: true),
+ Personaldevelopment = table.Column(name: "Personal development", type: "int", nullable: true),
+ Sixthformprovisionwhereapplicable = table.Column(name: "Sixth form provision (where applicable)", type: "int", nullable: true),
+ URNatCurrentfullinspection = table.Column(name: "URN at Current full inspection", type: "int", nullable: true),
+ URNatPreviousfullinspection = table.Column(name: "URN at Previous full inspection", type: "int", nullable: true),
+ URNatSection8inspection = table.Column(name: "URN at Section 8 inspection", type: "int", nullable: true),
+ AdministrativeDistrict = table.Column(name: "Administrative District", type: "nvarchar(max)", nullable: true),
+ RouteofProject = table.Column(name: "Route of Project", type: "nvarchar(max)", nullable: true),
+ GORregion = table.Column(type: "nvarchar(max)", nullable: true),
+ SFSOTerritory = table.Column(name: "SFSO Territory", type: "nvarchar(max)", nullable: true),
+ GiasLastChangedDate = table.Column