// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using MyPortal.Database.Models;

#nullable disable

namespace MyPortal.Database.Migrations
{
    [DbContext(typeof(ApplicationDbContext))]
    [Migration("20240307165823_InitialModel")]
    partial class InitialModel
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "6.0.2")
                .HasAnnotation("Relational:MaxIdentifierLength", 128);

            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AcademicTerm", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AcademicYearId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime>("EndDate")
                        .HasColumnType("date")
                        .HasColumnOrder(5);

                    b.Property<string>("Name")
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(3);

                    b.Property<DateTime>("StartDate")
                        .HasColumnType("date")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AcademicYearId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("AcademicTerms");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AcademicYear", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<bool>("Locked")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("AcademicYears");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AccountTransaction", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<decimal>("Amount")
                        .HasColumnType("decimal(10,2)")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime>("Date")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(4);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("StudentId");

                    b.ToTable("AccountTransactions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Achievement", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AcademicYearId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("AchievementTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Comments")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(8);

                    b.Property<Guid>("CreatedById")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.Property<DateTime>("CreatedDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(6);

                    b.Property<DateTime>("Date")
                        .HasColumnType("date")
                        .HasColumnOrder(7);

                    b.Property<bool>("Deleted")
                        .HasColumnType("bit")
                        .HasColumnOrder(9);

                    b.Property<Guid?>("LocationId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AcademicYearId");

                    b.HasIndex("AchievementTypeId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CreatedById");

                    b.HasIndex("LocationId");

                    b.ToTable("Achievements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AchievementOutcome", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("AchievementOutcomes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AchievementType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<int>("DefaultPoints")
                        .HasColumnType("int")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("AchievementTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Activity", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("StudentGroupId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("StudentGroupId");

                    b.ToTable("Activities");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Address", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<string>("Apartment")
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(4);

                    b.Property<string>("BuildingName")
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(3);

                    b.Property<string>("BuildingNumber")
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Country")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(10);

                    b.Property<string>("County")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(8);

                    b.Property<string>("District")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(6);

                    b.Property<string>("Postcode")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(9);

                    b.Property<string>("Street")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(5);

                    b.Property<string>("Town")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(7);

                    b.Property<bool>("Validated")
                        .HasColumnType("bit")
                        .HasColumnOrder(11);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("Addresses");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AddressAgency", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AddressId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("AddressTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<Guid>("AgencyId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<bool>("Main")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AddressId");

                    b.HasIndex("AddressTypeId");

                    b.HasIndex("AgencyId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("AddressAgencies");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AddressPerson", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AddressId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("AddressTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<bool>("Main")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.Property<Guid?>("PersonId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AddressId");

                    b.HasIndex("AddressTypeId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("PersonId");

                    b.ToTable("AddressPeople");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AddressType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("AddressTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Agency", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<bool>("Deleted")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.Property<Guid>("DirectoryId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<string>("Name")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(4);

                    b.Property<Guid>("TypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<string>("Website")
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("DirectoryId");

                    b.HasIndex("TypeId");

                    b.ToTable("Agencies");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AgencyType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("AgencyTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Agent", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AgencyId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("AgentTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<bool>("Deleted")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.Property<string>("JobTitle")
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(5);

                    b.Property<Guid>("PersonId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AgencyId");

                    b.HasIndex("AgentTypeId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("PersonId");

                    b.ToTable("Agents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AgentType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("AgentTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Aspect", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("ColumnHeading")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)")
                        .HasColumnOrder(9);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<Guid?>("GradeSetId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.Property<decimal?>("MaxMark")
                        .HasColumnType("decimal(10,2)")
                        .HasColumnOrder(7);

                    b.Property<decimal?>("MinMark")
                        .HasColumnType("decimal(10,2)")
                        .HasColumnOrder(6);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(8);

                    b.Property<bool>("Private")
                        .HasColumnType("bit")
                        .HasColumnOrder(10);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(11);

                    b.Property<Guid>("TypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("GradeSetId");

                    b.HasIndex("TypeId");

                    b.ToTable("Aspects");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AspectType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("AspectTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AttendanceCode", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.Property<Guid>("AttendanceCodeTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(1)
                        .HasColumnType("nvarchar(1)")
                        .HasColumnOrder(2);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(3);

                    b.Property<bool>("Restricted")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(7);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AttendanceCodeTypeId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("AttendanceCodes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AttendanceCodeType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("AttendanceCodeTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AttendanceMark", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("CodeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.Property<string>("Comments")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(7);

                    b.Property<Guid>("CreatedById")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(6);

                    b.Property<int>("MinutesLate")
                        .HasColumnType("int")
                        .HasColumnOrder(8);

                    b.Property<Guid>("PeriodId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("WeekId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CodeId");

                    b.HasIndex("CreatedById");

                    b.HasIndex("PeriodId");

                    b.HasIndex("StudentId");

                    b.HasIndex("WeekId");

                    b.ToTable("AttendanceMarks");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AttendancePeriod", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("AmReg")
                        .HasColumnType("bit")
                        .HasColumnOrder(7);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<TimeSpan>("EndTime")
                        .HasColumnType("time(2)")
                        .HasColumnOrder(6);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(4);

                    b.Property<bool>("PmReg")
                        .HasColumnType("bit")
                        .HasColumnOrder(8);

                    b.Property<TimeSpan>("StartTime")
                        .HasColumnType("time(2)")
                        .HasColumnOrder(5);

                    b.Property<Guid>("WeekPatternId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("Weekday")
                        .HasColumnType("int")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("WeekPatternId");

                    b.ToTable("AttendancePeriods");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AttendanceWeek", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AcademicTermId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<DateTime>("Beginning")
                        .HasColumnType("date")
                        .HasColumnOrder(4);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<bool>("IsNonTimetable")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.Property<Guid>("WeekPatternId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AcademicTermId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("WeekPatternId");

                    b.ToTable("AttendanceWeeks");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AttendanceWeekPattern", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("AttendanceWeekPatterns");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BasketItem", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("ProductId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("Quantity")
                        .HasColumnType("int")
                        .HasColumnOrder(4);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ProductId");

                    b.HasIndex("StudentId");

                    b.ToTable("BasketItems");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BehaviourOutcome", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("BehaviourOutcomes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BehaviourRoleType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<int>("DefaultPoints")
                        .HasColumnType("int")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("BehaviourRoleTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BehaviourStatus", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<bool>("Resolved")
                        .HasColumnType("bit")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("BehaviourStatus");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BehaviourTarget", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("BehaviourTargets");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Bill", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid?>("ChargeBillingPeriodId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime>("CreatedDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(4);

                    b.Property<bool?>("Dispatched")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.Property<DateTime>("DueDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(5);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ChargeBillingPeriodId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("StudentId");

                    b.ToTable("Bills");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BillAccountTransaction", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AccountTransactionId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("BillId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AccountTransactionId");

                    b.HasIndex("BillId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("BillAccountTransactions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BillDiscount", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("BillId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("DiscountId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<decimal>("GrossAmount")
                        .HasColumnType("decimal(10,2)")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("BillId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("DiscountId");

                    b.ToTable("BillDiscounts");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BillItem", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("BillId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<bool>("CustomerReceived")
                        .HasColumnType("bit")
                        .HasColumnOrder(7);

                    b.Property<decimal>("NetAmount")
                        .HasColumnType("decimal(10,2)")
                        .HasColumnOrder(5);

                    b.Property<Guid>("ProductId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("Quantity")
                        .HasColumnType("int")
                        .HasColumnOrder(4);

                    b.Property<bool>("Refunded")
                        .HasColumnType("bit")
                        .HasColumnOrder(8);

                    b.Property<decimal>("VatAmount")
                        .HasColumnType("decimal(10,2)")
                        .HasColumnOrder(6);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("BillId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ProductId");

                    b.ToTable("BillItems");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BillStudentCharge", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("BillId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<decimal>("NetAmount")
                        .HasColumnType("decimal(10,2)")
                        .HasColumnOrder(4);

                    b.Property<bool>("Refunded")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.Property<Guid>("StudentChargeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<decimal>("VatAmount")
                        .HasColumnType("decimal(10,2)")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("BillId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("StudentChargeId");

                    b.ToTable("BillCharges");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BoarderStatus", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("BoarderStatus");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Building", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("Buildings");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BuildingFloor", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<Guid>("BuildingId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("BuildingId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("BuildingFloors");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Bulletin", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Approved")
                        .HasColumnType("bit")
                        .HasColumnOrder(9);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("CreatedById")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<DateTime>("CreatedDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(4);

                    b.Property<string>("Detail")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(7);

                    b.Property<Guid>("DirectoryId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<DateTime?>("ExpireDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(5);

                    b.Property<bool>("Private")
                        .HasColumnType("bit")
                        .HasColumnOrder(8);

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)")
                        .HasColumnOrder(6);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CreatedById");

                    b.HasIndex("DirectoryId");

                    b.ToTable("Bulletins");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Charge", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<decimal>("Amount")
                        .HasColumnType("decimal(10,2)")
                        .HasColumnOrder(7);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .HasMaxLength(64)
                        .HasColumnType("nvarchar(64)")
                        .HasColumnOrder(5);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<string>("Name")
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(6);

                    b.Property<bool>("Variable")
                        .HasColumnType("bit")
                        .HasColumnOrder(8);

                    b.Property<Guid>("VatRateId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("VatRateId");

                    b.ToTable("Charges");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ChargeBillingPeriod", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime>("EndDate")
                        .HasColumnType("date")
                        .HasColumnOrder(4);

                    b.Property<string>("Name")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(2);

                    b.Property<DateTime>("StartDate")
                        .HasColumnType("date")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("ChargeBillingPeriods");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ChargeDiscount", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("ChargeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("DiscountId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ChargeId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("DiscountId");

                    b.ToTable("ChargeDiscounts");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Class", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)")
                        .HasColumnOrder(5);

                    b.Property<Guid>("CourseId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("CurriculumGroupId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("DirectoryId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CourseId");

                    b.HasIndex("CurriculumGroupId");

                    b.HasIndex("DirectoryId");

                    b.ToTable("Classes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Comment", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("CommentBankSectionId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("CommentTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<string>("Value")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CommentBankSectionId");

                    b.HasIndex("CommentTypeId");

                    b.ToTable("Comments");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CommentBank", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("CommentBanks");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CommentBankArea", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("CommentBankId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("CourseId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CommentBankId");

                    b.HasIndex("CourseId");

                    b.ToTable("CommentBankAreas");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CommentBankSection", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("CommentBankAreaId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CommentBankAreaId");

                    b.ToTable("CommentBankSections");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CommentType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("CommentTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CommunicationLog", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("CommunicationTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("ContactId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<DateTime>("Date")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(4);

                    b.Property<string>("Notes")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(5);

                    b.Property<bool>("Outgoing")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CommunicationTypeId");

                    b.HasIndex("ContactId");

                    b.ToTable("CommunicationLogs");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CommunicationType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("CommunicationTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Contact", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("JobTitle")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(5);

                    b.Property<string>("NiNumber")
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(6);

                    b.Property<bool>("ParentalBallot")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<Guid>("PersonId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<string>("PlaceOfWork")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("PersonId");

                    b.ToTable("Contacts");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Course", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<string>("Name")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(5);

                    b.Property<Guid>("SubjectId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("SubjectId");

                    b.ToTable("Courses");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CoverArrangement", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Comments")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(6);

                    b.Property<Guid?>("RoomId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.Property<Guid>("SessionId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid?>("TeacherId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<Guid>("WeekId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("RoomId");

                    b.HasIndex("SessionId");

                    b.HasIndex("TeacherId");

                    b.HasIndex("WeekId");

                    b.ToTable("CoverArrangements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CurriculumBand", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AcademicYearId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("CurriculumYearGroupId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("StudentGroupId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AcademicYearId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CurriculumYearGroupId");

                    b.HasIndex("StudentGroupId");

                    b.ToTable("CurriculumBands");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CurriculumBandBlockAssignment", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("BandId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("BlockId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("BandId");

                    b.HasIndex("BlockId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("CurriculumBandBlockAssignments");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CurriculumBlock", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)")
                        .HasColumnOrder(2);

                    b.Property<string>("Description")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("CurriculumBlocks");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CurriculumGroup", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("BlockId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("StudentGroupId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("BlockId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("StudentGroupId");

                    b.ToTable("CurriculumGroups");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CurriculumGroupSession", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("CurriculumGroupId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("SessionAmount")
                        .HasColumnType("int")
                        .HasColumnOrder(5);

                    b.Property<Guid>("SessionTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<Guid>("SubjectId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CurriculumGroupId");

                    b.HasIndex("SessionTypeId");

                    b.HasIndex("SubjectId");

                    b.ToTable("CurriculumGroupSessions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CurriculumYearGroup", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)")
                        .HasColumnOrder(4);

                    b.Property<int>("KeyStage")
                        .HasColumnType("int")
                        .HasColumnOrder(3);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("CurriculumYearGroups");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Detention", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("DetentionTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("EventId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid?>("SupervisorId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("DetentionTypeId");

                    b.HasIndex("EventId");

                    b.HasIndex("SupervisorId");

                    b.ToTable("Detentions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.DetentionType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<TimeSpan>("EndTime")
                        .HasColumnType("time(2)")
                        .HasColumnOrder(5);

                    b.Property<TimeSpan>("StartTime")
                        .HasColumnType("time(2)")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("DetentionTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.DiaryEvent", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("AllDay")
                        .HasColumnType("bit")
                        .HasColumnOrder(11);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid?>("CreatedById")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<DateTime>("CreatedDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(7);

                    b.Property<DateTime>("EndTime")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(10);

                    b.Property<Guid>("EventTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<string>("Location")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(8);

                    b.Property<bool>("Public")
                        .HasColumnType("bit")
                        .HasColumnOrder(12);

                    b.Property<Guid?>("RoomId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.Property<DateTime>("StartTime")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(9);

                    b.Property<string>("Subject")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(6);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(13);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CreatedById");

                    b.HasIndex("EventTypeId");

                    b.HasIndex("RoomId");

                    b.ToTable("DiaryEvents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.DiaryEventAttendee", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool?>("Attended")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.Property<bool>("CanEditEvent")
                        .HasColumnType("bit")
                        .HasColumnOrder(7);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("EventId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("PersonId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<bool>("Required")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.Property<Guid?>("ResponseId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("EventId");

                    b.HasIndex("PersonId");

                    b.HasIndex("ResponseId");

                    b.ToTable("DiaryEventAttendees");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.DiaryEventAttendeeResponse", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("DiaryEventAttendeeResponses");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.DiaryEventTemplate", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<int>("Days")
                        .HasColumnType("int")
                        .HasColumnOrder(7);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<Guid>("EventTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<int>("Hours")
                        .HasColumnType("int")
                        .HasColumnOrder(6);

                    b.Property<int>("Minutes")
                        .HasColumnType("int")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("EventTypeId");

                    b.ToTable("DiaryEventTemplates");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.DiaryEventType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("ColourCode")
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("DiaryEventTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.DietaryRequirement", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("DietaryRequirements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Directory", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(3);

                    b.Property<Guid?>("ParentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<bool>("Private")
                        .HasColumnType("bit")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ParentId");

                    b.ToTable("Directories");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Discount", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<decimal>("Amount")
                        .HasColumnType("decimal(10,2)")
                        .HasColumnOrder(5);

                    b.Property<bool>("BlockOtherDiscounts")
                        .HasColumnType("bit")
                        .HasColumnOrder(7);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<string>("Name")
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(4);

                    b.Property<bool>("Percentage")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("Discounts");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Document", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("CreatedById")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(7);

                    b.Property<DateTime>("CreatedDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(8);

                    b.Property<bool>("Deleted")
                        .HasColumnType("bit")
                        .HasColumnOrder(10);

                    b.Property<string>("Description")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(6);

                    b.Property<Guid>("DirectoryId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid?>("FileId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<bool>("Private")
                        .HasColumnType("bit")
                        .HasColumnOrder(9);

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(5);

                    b.Property<Guid>("TypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CreatedById");

                    b.HasIndex("DirectoryId");

                    b.HasIndex("FileId");

                    b.HasIndex("TypeId");

                    b.ToTable("Documents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.DocumentType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<bool>("Contact")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<bool>("General")
                        .HasColumnType("bit")
                        .HasColumnOrder(7);

                    b.Property<bool>("Sen")
                        .HasColumnType("bit")
                        .HasColumnOrder(8);

                    b.Property<bool>("Staff")
                        .HasColumnType("bit")
                        .HasColumnOrder(4);

                    b.Property<bool>("Student")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(9);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("DocumentTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.EmailAddress", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<string>("Address")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(5);

                    b.Property<Guid?>("AgencyId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<bool>("Main")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.Property<string>("Notes")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(7);

                    b.Property<Guid?>("PersonId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("TypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AgencyId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("PersonId");

                    b.HasIndex("TypeId");

                    b.ToTable("EmailAddresses");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.EmailAddressType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("EmailAddressTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.EnrolmentStatus", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("EnrolmentStatus");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Ethnicity", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("Ethnicities");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamAssessment", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("AssessmentType")
                        .HasColumnType("int")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("ExamBoardId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<string>("ExternalTitle")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(5);

                    b.Property<string>("InternalTitle")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ExamBoardId");

                    b.ToTable("ExamAssessments");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamAssessmentAspect", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AspectId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("AspectOrder")
                        .HasColumnType("int")
                        .HasColumnOrder(5);

                    b.Property<Guid>("AssessmentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("SeriesId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AspectId");

                    b.HasIndex("AssessmentId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("SeriesId");

                    b.ToTable("ExamAssessmentAspects");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamAssessmentMode", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<bool>("ExternallyAssessed")
                        .HasColumnType("bit")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("ExamAssessmentModes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamAward", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AssessmentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<string>("AwardCode")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(6);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid?>("CourseId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(5);

                    b.Property<DateTime?>("ExpiryDate")
                        .HasColumnType("date")
                        .HasColumnOrder(7);

                    b.Property<Guid>("QualificationId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AssessmentId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CourseId");

                    b.HasIndex("QualificationId");

                    b.ToTable("ExamAwards");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamAwardElement", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AwardId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("ElementId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AwardId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ElementId");

                    b.ToTable("ExamAwardElements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamAwardSeries", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AwardId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("SeriesId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AwardId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("ExamAwardSeries");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamBaseComponent", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AssessmentModeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("ComponentCode")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.Property<Guid>("ExamAssessmentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AssessmentModeId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ExamAssessmentId");

                    b.ToTable("ExamBaseComponents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamBaseElement", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AssessmentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("ElementCode")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(6);

                    b.Property<Guid>("LevelId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("QcaCodeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<string>("QualAccrNumber")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AssessmentId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("LevelId");

                    b.HasIndex("QcaCodeId");

                    b.ToTable("ExamBaseElements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamBoard", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<string>("Abbreviation")
                        .HasMaxLength(20)
                        .HasColumnType("nvarchar(20)")
                        .HasColumnOrder(2);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(7);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .HasMaxLength(5)
                        .HasColumnType("nvarchar(5)")
                        .HasColumnOrder(4);

                    b.Property<bool>("Domestic")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.Property<string>("FullName")
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(3);

                    b.Property<bool>("UseEdi")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("ExamBoards");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamCandidate", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<string>("CandidateNumber")
                        .HasMaxLength(4)
                        .HasColumnType("nvarchar(4)")
                        .HasColumnOrder(4);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Note")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(8);

                    b.Property<string>("PreviousCandidateNumber")
                        .HasMaxLength(4)
                        .HasColumnType("nvarchar(4)")
                        .HasColumnOrder(5);

                    b.Property<string>("PreviousCentreNumber")
                        .HasMaxLength(5)
                        .HasColumnType("nvarchar(5)")
                        .HasColumnOrder(6);

                    b.Property<bool>("SpecialConsideration")
                        .HasColumnType("bit")
                        .HasColumnOrder(7);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<string>("Uci")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("StudentId");

                    b.ToTable("ExamCandidate");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamCandidateSeries", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("CandidateId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Flag")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.Property<Guid>("SeriesId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("CandidateId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("SeriesId");

                    b.ToTable("ExamCandidateSeries");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamCandidateSpecialArrangement", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("CandidateId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("SpecialArrangementId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("CandidateId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("SpecialArrangementId");

                    b.ToTable("ExamCandidateSpecialArrangements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamComponent", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AssessmentModeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<Guid>("BaseComponentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime?>("DateDue")
                        .HasColumnType("date")
                        .HasColumnOrder(6);

                    b.Property<DateTime?>("DateSubmitted")
                        .HasColumnType("date")
                        .HasColumnOrder(7);

                    b.Property<Guid?>("ExamDateId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.Property<Guid>("ExamSeriesId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("MaximumMark")
                        .HasColumnType("int")
                        .HasColumnOrder(8);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AssessmentModeId");

                    b.HasIndex("BaseComponentId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ExamDateId");

                    b.HasIndex("ExamSeriesId");

                    b.ToTable("ExamComponents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamComponentSitting", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<TimeSpan?>("ActualStartTime")
                        .HasColumnType("time")
                        .HasColumnOrder(4);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("ComponentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("ExamRoomId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("ExtraTimePercent")
                        .HasColumnType("int")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ComponentId");

                    b.HasIndex("ExamRoomId");

                    b.ToTable("ExamComponentSittings");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamDate", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<int>("Duration")
                        .HasColumnType("int")
                        .HasColumnOrder(3);

                    b.Property<Guid>("SessionId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<DateTime>("SittingDate")
                        .HasColumnType("date")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("SessionId");

                    b.ToTable("ExamDates");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamElement", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("BaseElementId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(4);

                    b.Property<decimal?>("ExamFee")
                        .HasColumnType("decimal(10,2)")
                        .HasColumnOrder(5);

                    b.Property<Guid>("SeriesId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<bool>("Submitted")
                        .HasColumnType("bit");

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("BaseElementId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("SeriesId");

                    b.ToTable("ExamElements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamElementComponent", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("ComponentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("ElementId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ComponentId");

                    b.HasIndex("ElementId");

                    b.ToTable("ExamElementComponents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamEnrolment", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AwardId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("CandidateId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime?>("EndDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(5);

                    b.Property<string>("RegistrationNumber")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(6);

                    b.Property<DateTime>("StartDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AwardId");

                    b.HasIndex("CandidateId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("ExamEnrolments");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamQualification", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<string>("JcQualificationCode")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("ExamQualifications");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamQualificationLevel", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid?>("DefaultGradeSetId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<string>("JcLevelCode")
                        .HasMaxLength(25)
                        .HasColumnType("nvarchar(25)")
                        .HasColumnOrder(6);

                    b.Property<Guid>("QualificationId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(7);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("DefaultGradeSetId");

                    b.HasIndex("QualificationId");

                    b.ToTable("ExamQualificationLevels");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamResultEmbargo", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime>("EndTime")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(3);

                    b.Property<Guid>("ResultSetId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ResultSetId");

                    b.ToTable("ExamResultEmbargoes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamRoom", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<int>("Columns")
                        .HasColumnType("int")
                        .HasColumnOrder(3);

                    b.Property<Guid>("RoomId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("Rows")
                        .HasColumnType("int")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("RoomId");

                    b.ToTable("ExamRooms");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamRoomSeatBlock", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    b.Property<string>("Comments")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(5);

                    b.Property<Guid>("ExamRoomId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("SeatColumn")
                        .HasColumnType("int")
                        .HasColumnOrder(4);

                    b.Property<int>("SeatRow")
                        .HasColumnType("int")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    b.HasIndex("ExamRoomId");

                    b.ToTable("ExamRoomSeatBlocks");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamSeason", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("CalendarYear")
                        .HasColumnType("int")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<bool>("Default")
                        .HasColumnType("bit")
                        .HasColumnOrder(8);

                    b.Property<string>("Description")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(7);

                    b.Property<DateTime>("EndDate")
                        .HasColumnType("date")
                        .HasColumnOrder(5);

                    b.Property<string>("Name")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(6);

                    b.Property<Guid>("ResultSetId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<DateTime>("StartDate")
                        .HasColumnType("date")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ResultSetId");

                    b.ToTable("ExamSeasons");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamSeatAllocation", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.Property<bool>("Attended")
                        .HasColumnType("bit")
                        .HasColumnOrder(7);

                    b.Property<Guid>("CandidateId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<int>("SeatColumn")
                        .HasColumnType("int")
                        .HasColumnOrder(4);

                    b.Property<int>("SeatRow")
                        .HasColumnType("int")
                        .HasColumnOrder(3);

                    b.Property<Guid>("SittingId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("CandidateId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("SittingId");

                    b.ToTable("ExamSeatAllocations");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamSeries", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(5);

                    b.Property<Guid>("ExamBoardId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("ExamSeasonId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<string>("SeriesCode")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.Property<string>("Title")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(6);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ExamBoardId");

                    b.HasIndex("ExamSeasonId");

                    b.ToTable("ExamSeries");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamSession", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<TimeSpan>("StartTime")
                        .HasColumnType("time")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("ExamSessions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamSpecialArrangement", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(2);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("ExamSpecialArrangements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Exclusion", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<DateTime?>("AppealDate")
                        .HasColumnType("date")
                        .HasColumnOrder(9);

                    b.Property<DateTime?>("AppealResultDate")
                        .HasColumnType("date")
                        .HasColumnOrder(10);

                    b.Property<Guid?>("AppealResultId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(11);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Comments")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(7);

                    b.Property<bool>("Deleted")
                        .HasColumnType("bit")
                        .HasColumnOrder(8);

                    b.Property<DateTime?>("EndDate")
                        .HasColumnType("date")
                        .HasColumnOrder(6);

                    b.Property<Guid>("ExclusionReasonId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<Guid>("ExclusionTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<DateTime>("StartDate")
                        .HasColumnType("date")
                        .HasColumnOrder(5);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AppealResultId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ExclusionReasonId");

                    b.HasIndex("ExclusionTypeId");

                    b.HasIndex("StudentId");

                    b.ToTable("Exclusions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExclusionAppealResult", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("ExclusionAppealResults");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExclusionReason", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("ExclusionReasons");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExclusionType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("ExclusionTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.File", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("ContentType")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.Property<string>("FileId")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(2);

                    b.Property<string>("FileName")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("Files");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.GiftedTalented", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Notes")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("SubjectId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("StudentId");

                    b.HasIndex("SubjectId");

                    b.ToTable("GiftedTalentedStudents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.GovernanceType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("GovernanceTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Grade", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(25)
                        .HasColumnType("nvarchar(25)")
                        .HasColumnOrder(3);

                    b.Property<string>("Description")
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)")
                        .HasColumnOrder(4);

                    b.Property<Guid>("GradeSetId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<decimal>("Value")
                        .HasColumnType("decimal(10,2)")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("GradeSetId");

                    b.ToTable("Grades");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.GradeSet", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(4);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("GradeSets");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.HomeworkItem", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(4);

                    b.Property<Guid>("DirectoryId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("MaxPoints")
                        .HasColumnType("int")
                        .HasColumnOrder(6);

                    b.Property<bool>("SubmitOnline")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("DirectoryId");

                    b.ToTable("HomeworkItems");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.HomeworkSubmission", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Comments")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(7);

                    b.Property<Guid?>("DocumentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.Property<Guid>("HomeworkId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("PointsAchieved")
                        .HasColumnType("int")
                        .HasColumnOrder(6);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("TaskId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("DocumentId");

                    b.HasIndex("HomeworkId");

                    b.HasIndex("StudentId");

                    b.HasIndex("TaskId");

                    b.ToTable("HomeworkSubmissions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.House", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("ColourCode")
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)")
                        .HasColumnOrder(3);

                    b.Property<Guid?>("StaffMemberId")
                        .HasColumnType("uniqueidentifier");

                    b.Property<Guid>("StudentGroupId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("StaffMemberId");

                    b.HasIndex("StudentGroupId");

                    b.ToTable("Houses");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Incident", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AcademicYearId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("BehaviourTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Comments")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(7);

                    b.Property<Guid>("CreatedById")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.Property<DateTime>("CreatedDate")
                        .HasColumnType("date")
                        .HasColumnOrder(6);

                    b.Property<bool>("Deleted")
                        .HasColumnType("bit")
                        .HasColumnOrder(8);

                    b.Property<Guid?>("LocationId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AcademicYearId");

                    b.HasIndex("BehaviourTypeId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CreatedById");

                    b.HasIndex("LocationId");

                    b.ToTable("Incidents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.IncidentType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<int>("DefaultPoints")
                        .HasColumnType("int")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("IncidentTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.IntakeType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("IntakeTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Language", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("Languages");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.LessonPlan", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("CreatedById")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<DateTime>("CreatedDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(5);

                    b.Property<Guid>("DirectoryId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<int>("Order")
                        .HasColumnType("int")
                        .HasColumnOrder(6);

                    b.Property<string>("PlanContent")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(8);

                    b.Property<Guid>("StudyTopicId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(7);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CreatedById");

                    b.HasIndex("DirectoryId");

                    b.HasIndex("StudyTopicId");

                    b.ToTable("LessonPlans");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.LessonPlanHomeworkItem", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("HomeworkItemId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("LessonPlanId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("HomeworkItemId");

                    b.HasIndex("LessonPlanId");

                    b.ToTable("LessonPlanHomeworkItems");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.LessonPlanTemplate", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<string>("PlanTemplate")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("LessonPlanTemplates");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.LocalAuthority", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<int>("LeaCode")
                        .HasColumnType("int")
                        .HasColumnOrder(2);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(3);

                    b.Property<string>("Website")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("LocalAuthorities");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Location", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(2);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("Locations");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.LogNote", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AcademicYearId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("CreatedById")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<DateTime>("CreatedDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(7);

                    b.Property<bool>("Deleted")
                        .HasColumnType("bit")
                        .HasColumnOrder(9);

                    b.Property<string>("Message")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(6);

                    b.Property<bool>("Private")
                        .HasColumnType("bit")
                        .HasColumnOrder(8);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<Guid>("TypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AcademicYearId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CreatedById");

                    b.HasIndex("StudentId");

                    b.HasIndex("TypeId");

                    b.ToTable("LogNotes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.LogNoteType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("ColourCode")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<string>("IconClass")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("LogNoteTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Marksheet", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<bool>("Completed")
                        .HasColumnType("bit")
                        .HasColumnOrder(4);

                    b.Property<Guid>("MarksheetTemplateId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("StudentGroupId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("MarksheetTemplateId");

                    b.HasIndex("StudentGroupId");

                    b.ToTable("Marksheets");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.MarksheetColumn", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AspectId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<int>("DisplayOrder")
                        .HasColumnType("int")
                        .HasColumnOrder(5);

                    b.Property<bool>("ReadOnly")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.Property<Guid>("ResultSetId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<Guid>("TemplateId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AspectId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ResultSetId");

                    b.HasIndex("TemplateId");

                    b.ToTable("MarksheetColumns");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.MarksheetTemplate", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(4);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Name")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(2);

                    b.Property<string>("Notes")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("MarksheetTemplates");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.MedicalCondition", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("MedicalConditions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.MedicalEvent", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("CreatedById")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<DateTime>("CreatedDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(4);

                    b.Property<DateTime>("Date")
                        .HasColumnType("date")
                        .HasColumnOrder(5);

                    b.Property<string>("Note")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(6);

                    b.Property<Guid>("PersonId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CreatedById");

                    b.HasIndex("PersonId");

                    b.ToTable("MedicalEvents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.NextOfKin", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("NextOfKinPersonId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("RelationshipTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<Guid>("StaffMemberId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("NextOfKinPersonId");

                    b.HasIndex("RelationshipTypeId");

                    b.HasIndex("StaffMemberId");

                    b.ToTable("NextOfKin");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.NextOfKinRelationshipType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("NextOfKinRelationshipTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Observation", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime>("Date")
                        .HasColumnType("date")
                        .HasColumnOrder(2);

                    b.Property<string>("Notes")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(6);

                    b.Property<Guid>("ObserveeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("ObserverId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<Guid>("OutcomeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ObserveeId");

                    b.HasIndex("ObserverId");

                    b.HasIndex("OutcomeId");

                    b.ToTable("Observations");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ObservationOutcome", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("ColourCode")
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("ObservationOutcomes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ParentEvening", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<DateTime>("BookingClosed")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(5);

                    b.Property<DateTime>("BookingOpened")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(4);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("EventId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<string>("Name")
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("EventId");

                    b.ToTable("ParentEvenings");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ParentEveningAppointment", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool?>("Attended")
                        .HasColumnType("bit")
                        .HasColumnOrder(8);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime>("End")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(5);

                    b.Property<bool>("ParentAccepted")
                        .HasColumnType("bit")
                        .HasColumnOrder(7);

                    b.Property<Guid>("ParentEveningStaffId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<DateTime>("Start")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(4);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<bool>("TeacherAccepted")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ParentEveningStaffId");

                    b.HasIndex("StudentId");

                    b.ToTable("ParentEveningAppointments");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ParentEveningBreak", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime>("End")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(4);

                    b.Property<Guid>("ParentEveningStaffMemberId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<DateTime>("Start")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ParentEveningStaffMemberId");

                    b.ToTable("ParentEveningBreaks");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ParentEveningGroup", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("ParentEveningId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("StudentGroupId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ParentEveningId");

                    b.HasIndex("StudentGroupId");

                    b.ToTable("ParentEveningGroup");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ParentEveningStaffMember", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("AppointmentLength")
                        .HasColumnType("int")
                        .HasColumnOrder(6);

                    b.Property<DateTime?>("AvailableFrom")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(4);

                    b.Property<DateTime?>("AvailableTo")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(5);

                    b.Property<int>("BreakLimit")
                        .HasColumnType("int")
                        .HasColumnOrder(7);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("ParentEveningId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("StaffMemberId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ParentEveningId");

                    b.HasIndex("StaffMemberId");

                    b.ToTable("ParentEveningStaffMembers");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Person", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime>("CreatedDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(11);

                    b.Property<DateTime?>("Deceased")
                        .HasColumnType("date")
                        .HasColumnOrder(14);

                    b.Property<bool>("Deleted")
                        .HasColumnType("bit")
                        .HasColumnOrder(16);

                    b.Property<Guid>("DirectoryId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<DateTime?>("Dob")
                        .HasColumnType("date")
                        .HasColumnOrder(13);

                    b.Property<Guid?>("EthnicityId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(15);

                    b.Property<string>("FirstName")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(6);

                    b.Property<string>("Gender")
                        .IsRequired()
                        .HasMaxLength(1)
                        .IsUnicode(false)
                        .HasColumnType("char(1)")
                        .HasColumnOrder(12)
                        .IsFixedLength();

                    b.Property<string>("LastName")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(8);

                    b.Property<string>("MiddleName")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(7);

                    b.Property<string>("NhsNumber")
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)")
                        .HasColumnOrder(10);

                    b.Property<Guid?>("PhotoId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(9);

                    b.Property<string>("PreferredFirstName")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(4);

                    b.Property<string>("PreferredLastName")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(5);

                    b.Property<string>("Title")
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("DirectoryId");

                    b.HasIndex("EthnicityId");

                    b.HasIndex("PhotoId");

                    b.ToTable("People");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.PersonCondition", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("ConditionId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<string>("Medication")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(5);

                    b.Property<bool>("MedicationTaken")
                        .HasColumnType("bit")
                        .HasColumnOrder(4);

                    b.Property<Guid>("PersonId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ConditionId");

                    b.HasIndex("PersonId");

                    b.ToTable("PersonConditions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.PersonDietaryRequirement", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("DietaryRequirementId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("PersonId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("DietaryRequirementId");

                    b.HasIndex("PersonId");

                    b.ToTable("PersonDietaryRequirements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.PhoneNumber", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid?>("AgencyId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<bool>("Main")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.Property<string>("Number")
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(5);

                    b.Property<Guid?>("PersonId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("TypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AgencyId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("PersonId");

                    b.HasIndex("TypeId");

                    b.ToTable("PhoneNumbers");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.PhoneNumberType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("PhoneNumberTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Photo", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<byte[]>("Data")
                        .HasColumnType("varbinary(max)")
                        .HasColumnOrder(2);

                    b.Property<string>("MimeType")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.Property<DateTime>("PhotoDate")
                        .HasColumnType("date")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("Photos");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Product", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<bool>("Deleted")
                        .HasColumnType("bit")
                        .HasColumnOrder(9);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(5);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(4);

                    b.Property<int>("OrderLimit")
                        .HasColumnType("int")
                        .HasColumnOrder(8);

                    b.Property<decimal>("Price")
                        .HasColumnType("decimal(10,2)")
                        .HasColumnOrder(6);

                    b.Property<Guid>("ProductTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<bool>("ShowOnStore")
                        .HasColumnType("bit")
                        .HasColumnOrder(7);

                    b.Property<Guid>("VatRateId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ProductTypeId");

                    b.HasIndex("VatRateId");

                    b.ToTable("Products");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ProductType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<bool>("IsMeal")
                        .HasColumnType("bit")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("ProductTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.RegGroup", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid?>("RoomId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<Guid?>("StaffMemberId")
                        .HasColumnType("uniqueidentifier");

                    b.Property<Guid>("StudentGroupId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("YearGroupId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("StaffMemberId");

                    b.HasIndex("StudentGroupId");

                    b.HasIndex("YearGroupId");

                    b.ToTable("RegGroups");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.RelationshipType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("RelationshipTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ReportCard", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(7);

                    b.Property<Guid>("BehaviourTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Comments")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(6);

                    b.Property<DateTime>("EndDate")
                        .HasColumnType("date")
                        .HasColumnOrder(5);

                    b.Property<DateTime>("StartDate")
                        .HasColumnType("date")
                        .HasColumnOrder(4);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("BehaviourTypeId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("StudentId");

                    b.ToTable("ReportCards");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ReportCardEntry", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid?>("AttendanceWeekId")
                        .HasColumnType("uniqueidentifier");

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Comments")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(7);

                    b.Property<Guid>("CreatedById")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<DateTime>("CreatedDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(4);

                    b.Property<Guid>("PeriodId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(6);

                    b.Property<Guid>("ReportCardId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("WeekId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AttendanceWeekId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CreatedById");

                    b.HasIndex("PeriodId");

                    b.HasIndex("ReportCardId");

                    b.ToTable("ReportCardEntries");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ReportCardTarget", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("ReportCardId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("TargetId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ReportCardId");

                    b.HasIndex("TargetId");

                    b.ToTable("ReportCardTargets");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ReportCardTargetEntry", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("EntryId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<bool>("TargetCompleted")
                        .HasColumnType("bit")
                        .HasColumnOrder(4);

                    b.Property<Guid>("TargetId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("EntryId");

                    b.HasIndex("TargetId");

                    b.ToTable("ReportCardTargetEntries");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Result", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AspectId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("ColourCode")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(10);

                    b.Property<string>("Comment")
                        .HasMaxLength(1000)
                        .HasColumnType("nvarchar(1000)")
                        .HasColumnOrder(9);

                    b.Property<Guid>("CreatedById")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.Property<DateTime>("Date")
                        .HasColumnType("date")
                        .HasColumnOrder(6);

                    b.Property<Guid?>("GradeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(7);

                    b.Property<decimal?>("Mark")
                        .HasColumnType("decimal(10,2)")
                        .HasColumnOrder(8);

                    b.Property<string>("Note")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(11);

                    b.Property<Guid>("ResultSetId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AspectId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CreatedById");

                    b.HasIndex("GradeId");

                    b.HasIndex("ResultSetId");

                    b.HasIndex("StudentId");

                    b.ToTable("Results");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ResultSet", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<bool>("Locked")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(4);

                    b.Property<DateTime?>("PublishDate")
                        .HasColumnType("date")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("ResultSets");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Role", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier");

                    b.Property<string>("ConcurrencyStamp")
                        .IsConcurrencyToken()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Description")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Name")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)");

                    b.Property<string>("NormalizedName")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)");

                    b.Property<byte[]>("Permissions")
                        .HasColumnType("varbinary(max)");

                    b.Property<bool>("System")
                        .HasColumnType("bit");

                    b.HasKey("Id");

                    b.HasIndex("NormalizedName")
                        .IsUnique()
                        .HasDatabaseName("RoleNameIndex")
                        .HasFilter("[NormalizedName] IS NOT NULL");

                    b.ToTable("Roles", (string)null);
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.RoleClaim", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);

                    b.Property<string>("ClaimType")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("ClaimValue")
                        .HasColumnType("nvarchar(max)");

                    b.Property<Guid>("RoleId")
                        .HasColumnType("uniqueidentifier");

                    b.HasKey("Id");

                    b.HasIndex("RoleId");

                    b.ToTable("RoleClaims", (string)null);
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Room", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid?>("BuildingFloorId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)")
                        .HasColumnOrder(3);

                    b.Property<bool>("ExcludeFromCover")
                        .HasColumnType("bit")
                        .HasColumnOrder(7);

                    b.Property<Guid?>("LocationId")
                        .HasColumnType("uniqueidentifier");

                    b.Property<int>("MaxGroupSize")
                        .HasColumnType("int")
                        .HasColumnOrder(5);

                    b.Property<string>("Name")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(4);

                    b.Property<string>("TelephoneNo")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(6);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("BuildingFloorId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("LocationId");

                    b.ToTable("Rooms");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.RoomClosure", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime>("EndDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(5);

                    b.Property<string>("Notes")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(6);

                    b.Property<Guid>("ReasonId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("RoomId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<DateTime>("StartDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ReasonId");

                    b.HasIndex("RoomId");

                    b.ToTable("RoomClosures");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.RoomClosureReason", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("RoomClosureReasons");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.School", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AgencyId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<int>("EstablishmentNumber")
                        .HasColumnType("int")
                        .HasColumnOrder(4);

                    b.Property<Guid>("GovernanceTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(9);

                    b.Property<Guid?>("HeadTeacherId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(11);

                    b.Property<Guid>("IntakeTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(10);

                    b.Property<bool>("Local")
                        .HasColumnType("bit")
                        .HasColumnOrder(12);

                    b.Property<Guid?>("LocalAuthorityId")
                        .IsRequired()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("PhaseId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(7);

                    b.Property<Guid>("TypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(8);

                    b.Property<string>("Uprn")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(6);

                    b.Property<string>("Urn")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AgencyId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("GovernanceTypeId");

                    b.HasIndex("HeadTeacherId");

                    b.HasIndex("IntakeTypeId");

                    b.HasIndex("LocalAuthorityId");

                    b.HasIndex("PhaseId");

                    b.HasIndex("TypeId");

                    b.ToTable("Schools");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SchoolPhase", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("SchoolPhases");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SchoolType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("SchoolTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenEvent", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime>("Date")
                        .HasColumnType("date")
                        .HasColumnOrder(4);

                    b.Property<Guid>("EventTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<string>("Note")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(5);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("EventTypeId");

                    b.HasIndex("StudentId");

                    b.ToTable("SenEvents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenEventType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("SenEventTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenProvision", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime>("EndDate")
                        .HasColumnType("date")
                        .HasColumnOrder(5);

                    b.Property<string>("Note")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(6);

                    b.Property<Guid>("ProvisionTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<DateTime>("StartDate")
                        .HasColumnType("date")
                        .HasColumnOrder(4);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ProvisionTypeId");

                    b.HasIndex("StudentId");

                    b.ToTable("SenProvisions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenProvisionType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("SenProvisionTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenReview", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Comments")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(8);

                    b.Property<Guid>("EventId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(6);

                    b.Property<Guid?>("OutcomeSenStatusId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(7);

                    b.Property<Guid>("ReviewStatusId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<Guid>("ReviewTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid?>("SencoId")
                        .IsRequired()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("EventId");

                    b.HasIndex("OutcomeSenStatusId");

                    b.HasIndex("ReviewStatusId");

                    b.HasIndex("ReviewTypeId");

                    b.HasIndex("SencoId");

                    b.HasIndex("StudentId");

                    b.ToTable("SenReviews");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenReviewStatus", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("SenReviewStatuses");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenReviewType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("SenReviewTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenStatus", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(1)
                        .IsUnicode(false)
                        .HasColumnType("char(1)")
                        .HasColumnOrder(4)
                        .IsFixedLength();

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("SenStatus");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("SenTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Session", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("ClassId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime>("EndDate")
                        .HasColumnType("date")
                        .HasColumnOrder(7);

                    b.Property<Guid?>("RoomId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.Property<DateTime>("StartDate")
                        .HasColumnType("date")
                        .HasColumnOrder(6);

                    b.Property<Guid>("TeacherId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClassId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("RoomId");

                    b.HasIndex("TeacherId");

                    b.ToTable("Sessions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SessionExtraName", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AttendanceWeekId")
                        .HasColumnType("uniqueidentifier");

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("SessionId")
                        .HasColumnType("uniqueidentifier");

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier");

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AttendanceWeekId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("SessionId");

                    b.HasIndex("StudentId");

                    b.ToTable("SessionExtraNames");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SessionPeriod", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("PeriodId")
                        .HasColumnType("uniqueidentifier");

                    b.Property<Guid>("SessionId")
                        .HasColumnType("uniqueidentifier");

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("PeriodId");

                    b.HasIndex("SessionId");

                    b.ToTable("SessionPeriods");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SessionType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<int>("Length")
                        .HasColumnType("int")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("SessionTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StaffAbsence", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AbsenceTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<bool>("Confidential")
                        .HasColumnType("bit")
                        .HasColumnOrder(7);

                    b.Property<DateTime>("EndDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(6);

                    b.Property<Guid?>("IllnessTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<string>("Notes")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(8);

                    b.Property<Guid>("StaffMemberId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<DateTime>("StartDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AbsenceTypeId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("IllnessTypeId");

                    b.HasIndex("StaffMemberId");

                    b.ToTable("StaffAbsences");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StaffAbsenceType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<bool>("Authorised")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("StaffAbsenceTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StaffIllnessType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("StaffIllnessTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StaffMember", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<string>("BankAccount")
                        .HasMaxLength(15)
                        .HasColumnType("nvarchar(15)")
                        .HasColumnOrder(6);

                    b.Property<string>("BankName")
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)")
                        .HasColumnOrder(5);

                    b.Property<string>("BankSortCode")
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)")
                        .HasColumnOrder(7);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(4);

                    b.Property<bool>("Deleted")
                        .HasColumnType("bit")
                        .HasColumnOrder(11);

                    b.Property<Guid?>("LineManagerId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<string>("NiNumber")
                        .HasMaxLength(9)
                        .HasColumnType("nvarchar(9)")
                        .HasColumnOrder(8);

                    b.Property<Guid>("PersonId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<string>("Qualifications")
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(9);

                    b.Property<bool>("TeachingStaff")
                        .HasColumnType("bit")
                        .HasColumnOrder(10);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("LineManagerId");

                    b.HasIndex("PersonId");

                    b.ToTable("StaffMembers");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StoreDiscount", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int?>("ApplyTo")
                        .HasColumnType("int")
                        .HasColumnOrder(6);

                    b.Property<bool>("ApplyToCart")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("DiscountId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<Guid?>("ProductId")
                        .IsRequired()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid?>("ProductTypeId")
                        .IsRequired()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("DiscountId");

                    b.HasIndex("ProductId");

                    b.HasIndex("ProductTypeId");

                    b.ToTable("StoreDiscounts");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Student", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("AdmissionNumber")
                        .HasColumnType("int")
                        .HasColumnOrder(3);

                    b.Property<Guid?>("BoarderStatusId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(10);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime?>("DateLeaving")
                        .HasColumnType("date")
                        .HasColumnOrder(5);

                    b.Property<DateTime?>("DateStarting")
                        .HasColumnType("date")
                        .HasColumnOrder(4);

                    b.Property<bool>("Deleted")
                        .HasColumnType("bit")
                        .HasColumnOrder(13);

                    b.Property<Guid?>("EnrolmentStatusId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(9);

                    b.Property<bool>("FreeSchoolMeals")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.Property<Guid>("PersonId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<bool>("PupilPremium")
                        .HasColumnType("bit")
                        .HasColumnOrder(11);

                    b.Property<Guid?>("SenStatusId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(7);

                    b.Property<Guid?>("SenTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(8);

                    b.Property<string>("Upn")
                        .HasMaxLength(13)
                        .IsUnicode(false)
                        .HasColumnType("varchar(13)")
                        .HasColumnOrder(12);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("BoarderStatusId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("EnrolmentStatusId");

                    b.HasIndex("PersonId");

                    b.HasIndex("SenStatusId");

                    b.HasIndex("SenTypeId");

                    b.ToTable("Students");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentAchievement", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AchievementId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid?>("OutcomeId")
                        .IsRequired()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<int>("Points")
                        .HasColumnType("int")
                        .HasColumnOrder(5);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AchievementId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("OutcomeId");

                    b.HasIndex("StudentId");

                    b.ToTable("StudentAchievements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentAgentRelationship", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("AgentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("RelationshipTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AgentId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("RelationshipTypeId");

                    b.HasIndex("StudentId");

                    b.ToTable("StudentAgentRelationships");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentCharge", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("ChargeBillingPeriodId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<Guid>("ChargeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(5);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ChargeBillingPeriodId");

                    b.HasIndex("ChargeId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("StudentId");

                    b.ToTable("StudentCharges");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentChargeDiscount", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<Guid>("ChargeDiscountId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ChargeDiscountId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("StudentId");

                    b.ToTable("StudentChargeDiscounts");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentContactRelationship", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("ContactId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<bool>("Correspondence")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.Property<bool>("CourtOrder")
                        .HasColumnType("bit")
                        .HasColumnOrder(8);

                    b.Property<bool>("ParentalResponsibility")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.Property<bool>("PupilReport")
                        .HasColumnType("bit")
                        .HasColumnOrder(7);

                    b.Property<Guid>("RelationshipTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("ContactId");

                    b.HasIndex("RelationshipTypeId");

                    b.HasIndex("StudentId");

                    b.ToTable("StudentContactRelationships");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentDetention", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Attended")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("DetentionId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid?>("LinkedIncidentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<string>("Notes")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(6);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("DetentionId");

                    b.HasIndex("LinkedIncidentId");

                    b.HasIndex("StudentId");

                    b.ToTable("StudentDetentions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentGroup", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<Guid?>("MainSupervisorId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(6);

                    b.Property<int?>("MaxMembers")
                        .HasColumnType("int")
                        .HasColumnOrder(7);

                    b.Property<string>("Notes")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(8);

                    b.Property<Guid?>("PromoteToGroupId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(9);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("MainSupervisorId");

                    b.HasIndex("PromoteToGroupId");

                    b.ToTable("StudentGroups");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentGroupMembership", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime?>("EndDate")
                        .HasColumnType("date")
                        .HasColumnOrder(5);

                    b.Property<DateTime>("StartDate")
                        .HasColumnType("date")
                        .HasColumnOrder(4);

                    b.Property<Guid>("StudentGroupId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("StudentGroupId");

                    b.HasIndex("StudentId");

                    b.ToTable("StudentGroupMemberships");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentGroupSupervisor", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("StudentGroupId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("SupervisorId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<string>("Title")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("StudentGroupId");

                    b.HasIndex("SupervisorId");

                    b.ToTable("StudentGroupSupervisors");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentIncident", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("IncidentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid?>("OutcomeId")
                        .IsRequired()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.Property<int>("Points")
                        .HasColumnType("int")
                        .HasColumnOrder(7);

                    b.Property<Guid>("RoleTypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<Guid>("StatusId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(6);

                    b.Property<Guid>("StudentId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("IncidentId");

                    b.HasIndex("OutcomeId");

                    b.HasIndex("RoleTypeId");

                    b.HasIndex("StatusId");

                    b.HasIndex("StudentId");

                    b.ToTable("StudentIncidents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudyTopic", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("CourseId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(5);

                    b.Property<int>("Order")
                        .HasColumnType("int")
                        .HasColumnOrder(6);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CourseId");

                    b.ToTable("StudyTopics");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Subject", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(5)
                        .HasColumnType("nvarchar(5)")
                        .HasColumnOrder(4);

                    b.Property<bool>("Deleted")
                        .HasColumnType("bit")
                        .HasColumnOrder(5);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(3);

                    b.Property<Guid>("SubjectCodeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("SubjectCodeId");

                    b.ToTable("Subjects");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SubjectCode", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<Guid>("SubjectCodeSetId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("SubjectCodeSetId");

                    b.ToTable("SubjectCodes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SubjectCodeSet", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("SubjectCodeSets");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SubjectStaffMember", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("RoleId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<Guid>("StaffMemberId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("SubjectId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("RoleId");

                    b.HasIndex("StaffMemberId");

                    b.HasIndex("SubjectId");

                    b.ToTable("SubjectStaffMembers");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SubjectStaffMemberRole", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<bool>("SubjectLeader")
                        .HasColumnType("bit");

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("SubjectStaffMemberRoles");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SystemSetting", b =>
                {
                    b.Property<string>("Name")
                        .HasColumnType("nvarchar(450)")
                        .HasColumnOrder(0);

                    b.Property<string>("Setting")
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(1);

                    b.HasKey("Name");

                    b.ToTable("SystemSettings");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Task", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("AllowEdit")
                        .HasColumnType("bit")
                        .HasColumnOrder(11);

                    b.Property<Guid?>("AssignedToId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<bool>("Completed")
                        .HasColumnType("bit")
                        .HasColumnOrder(10);

                    b.Property<DateTime?>("CompletedDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(7);

                    b.Property<Guid>("CreatedById")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.Property<DateTime>("CreatedDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(5);

                    b.Property<string>("Description")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(9);

                    b.Property<DateTime?>("DueDate")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(6);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(12);

                    b.Property<string>("Title")
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(8);

                    b.Property<Guid>("TypeId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("AssignedToId");

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CreatedById");

                    b.HasIndex("TypeId");

                    b.ToTable("Tasks");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.TaskReminder", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<DateTime>("RemindTime")
                        .HasColumnType("datetime2")
                        .HasColumnOrder(4);

                    b.Property<Guid>("TaskId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("UserId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("TaskId");

                    b.ToTable("TaskReminders");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.TaskType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("ColourCode")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)")
                        .HasColumnOrder(5);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<bool>("Personal")
                        .HasColumnType("bit")
                        .HasColumnOrder(4);

                    b.Property<bool>("System")
                        .HasColumnType("bit")
                        .HasColumnOrder(6);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("TaskTypes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.TrainingCertificate", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("CourseId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.Property<Guid>("StaffId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("StatusId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CourseId");

                    b.HasIndex("StaffId");

                    b.HasIndex("StatusId");

                    b.ToTable("TrainingCertificates");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.TrainingCertificateStatus", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("ColourCode")
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("TrainingCertificateStatus");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.TrainingCourse", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(4);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("nvarchar(128)")
                        .HasColumnOrder(5);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("TrainingCourses");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.User", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier");

                    b.Property<int>("AccessFailedCount")
                        .HasColumnType("int");

                    b.Property<string>("ConcurrencyStamp")
                        .IsConcurrencyToken()
                        .HasColumnType("nvarchar(max)");

                    b.Property<DateTime>("CreatedDate")
                        .HasColumnType("datetime2");

                    b.Property<string>("Email")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)");

                    b.Property<bool>("EmailConfirmed")
                        .HasColumnType("bit");

                    b.Property<bool>("Enabled")
                        .HasColumnType("bit");

                    b.Property<bool>("LockoutEnabled")
                        .HasColumnType("bit");

                    b.Property<DateTimeOffset?>("LockoutEnd")
                        .HasColumnType("datetimeoffset");

                    b.Property<string>("NormalizedEmail")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)");

                    b.Property<string>("NormalizedUserName")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)");

                    b.Property<string>("PasswordHash")
                        .HasColumnType("nvarchar(max)");

                    b.Property<Guid?>("PersonId")
                        .HasColumnType("uniqueidentifier");

                    b.Property<string>("PhoneNumber")
                        .HasColumnType("nvarchar(max)");

                    b.Property<bool>("PhoneNumberConfirmed")
                        .HasColumnType("bit");

                    b.Property<string>("SecurityStamp")
                        .HasColumnType("nvarchar(max)");

                    b.Property<bool>("TwoFactorEnabled")
                        .HasColumnType("bit");

                    b.Property<string>("UserName")
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)");

                    b.Property<int>("UserType")
                        .HasMaxLength(1)
                        .HasColumnType("int");

                    b.HasKey("Id");

                    b.HasIndex("NormalizedEmail")
                        .HasDatabaseName("EmailIndex");

                    b.HasIndex("NormalizedUserName")
                        .IsUnique()
                        .HasDatabaseName("UserNameIndex")
                        .HasFilter("[NormalizedUserName] IS NOT NULL");

                    b.HasIndex("PersonId");

                    b.ToTable("Users", (string)null);
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.UserClaim", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);

                    b.Property<string>("ClaimType")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("ClaimValue")
                        .HasColumnType("nvarchar(max)");

                    b.Property<Guid>("UserId")
                        .HasColumnType("uniqueidentifier");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("UserClaims", (string)null);
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.UserLogin", b =>
                {
                    b.Property<string>("LoginProvider")
                        .HasColumnType("nvarchar(450)");

                    b.Property<string>("ProviderKey")
                        .HasColumnType("nvarchar(450)");

                    b.Property<string>("ProviderDisplayName")
                        .HasColumnType("nvarchar(max)");

                    b.Property<Guid>("UserId")
                        .HasColumnType("uniqueidentifier");

                    b.HasKey("LoginProvider", "ProviderKey");

                    b.HasIndex("UserId");

                    b.ToTable("UserLogins", (string)null);
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.UserReminderSetting", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    b.Property<TimeSpan>("RemindBefore")
                        .HasColumnType("time")
                        .HasColumnOrder(4);

                    b.Property<Guid>("ReminderType")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid>("UserId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("UserReminderSettings");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.UserRole", b =>
                {
                    b.Property<Guid>("UserId")
                        .HasColumnType("uniqueidentifier");

                    b.Property<Guid>("RoleId")
                        .HasColumnType("uniqueidentifier");

                    b.HasKey("UserId", "RoleId");

                    b.HasIndex("RoleId");

                    b.ToTable("UserRoles", (string)null);
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.UserToken", b =>
                {
                    b.Property<Guid>("UserId")
                        .HasColumnType("uniqueidentifier");

                    b.Property<string>("LoginProvider")
                        .HasColumnType("nvarchar(450)");

                    b.Property<string>("Name")
                        .HasColumnType("nvarchar(450)");

                    b.Property<string>("Value")
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("UserId", "LoginProvider", "Name");

                    b.ToTable("UserTokens", (string)null);
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.VatRate", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<bool>("Active")
                        .HasColumnType("bit")
                        .HasColumnOrder(3);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("nvarchar(256)")
                        .HasColumnOrder(2);

                    b.Property<decimal>("Value")
                        .HasColumnType("decimal(10,2)")
                        .HasColumnOrder(4);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.ToTable("VatRates");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.YearGroup", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(0);

                    b.Property<int>("ClusterId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasColumnOrder(1);

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClusterId"), 1L, 1);

                    b.Property<Guid>("CurriculumYearGroupId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(3);

                    b.Property<Guid?>("StaffMemberId")
                        .HasColumnType("uniqueidentifier");

                    b.Property<Guid>("StudentGroupId")
                        .HasColumnType("uniqueidentifier")
                        .HasColumnOrder(2);

                    b.HasKey("Id");

                    SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);

                    b.HasIndex("ClusterId")
                        .IsUnique()
                        .HasDatabaseName("CIX_ClusterId");

                    SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ClusterId"));

                    b.HasIndex("CurriculumYearGroupId");

                    b.HasIndex("StaffMemberId");

                    b.HasIndex("StudentGroupId");

                    b.ToTable("YearGroups");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AcademicTerm", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.AcademicYear", "AcademicYear")
                        .WithMany("AcademicTerms")
                        .HasForeignKey("AcademicYearId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("AcademicYear");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AccountTransaction", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("AccountTransactions")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Achievement", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.AcademicYear", "AcademicYear")
                        .WithMany("Achievements")
                        .HasForeignKey("AcademicYearId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.AchievementType", "Type")
                        .WithMany("Achievements")
                        .HasForeignKey("AchievementTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.User", "CreatedBy")
                        .WithMany("Achievements")
                        .HasForeignKey("CreatedById")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Location", "Location")
                        .WithMany("BehaviourAchievements")
                        .HasForeignKey("LocationId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("AcademicYear");

                    b.Navigation("CreatedBy");

                    b.Navigation("Location");

                    b.Navigation("Type");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Activity", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.StudentGroup", "StudentGroup")
                        .WithMany("Activities")
                        .HasForeignKey("StudentGroupId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("StudentGroup");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AddressAgency", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Address", "Address")
                        .WithMany("AddressAgencies")
                        .HasForeignKey("AddressId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.AddressType", "AddressType")
                        .WithMany("AddressAgencies")
                        .HasForeignKey("AddressTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Agency", "Agency")
                        .WithMany("AddressAgencies")
                        .HasForeignKey("AgencyId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Address");

                    b.Navigation("AddressType");

                    b.Navigation("Agency");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AddressPerson", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Address", "Address")
                        .WithMany("AddressPeople")
                        .HasForeignKey("AddressId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.AddressType", "AddressType")
                        .WithMany("AddressPersons")
                        .HasForeignKey("AddressTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Person", "Person")
                        .WithMany("AddressPeople")
                        .HasForeignKey("PersonId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("Address");

                    b.Navigation("AddressType");

                    b.Navigation("Person");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Agency", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Directory", "Directory")
                        .WithMany("Agencies")
                        .HasForeignKey("DirectoryId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.AgencyType", "AgencyType")
                        .WithMany("Agencies")
                        .HasForeignKey("TypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("AgencyType");

                    b.Navigation("Directory");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Agent", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Agency", "Agency")
                        .WithMany("Agents")
                        .HasForeignKey("AgencyId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.AgentType", "AgentType")
                        .WithMany("Agents")
                        .HasForeignKey("AgentTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Person", "Person")
                        .WithMany("Agents")
                        .HasForeignKey("PersonId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Agency");

                    b.Navigation("AgentType");

                    b.Navigation("Person");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Aspect", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.GradeSet", "GradeSet")
                        .WithMany("Aspects")
                        .HasForeignKey("GradeSetId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.AspectType", "Type")
                        .WithMany("Aspects")
                        .HasForeignKey("TypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("GradeSet");

                    b.Navigation("Type");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AttendanceCode", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.AttendanceCodeType", "CodeType")
                        .WithMany("Codes")
                        .HasForeignKey("AttendanceCodeTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("CodeType");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AttendanceMark", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.AttendanceCode", "AttendanceCode")
                        .WithMany("AttendanceMarks")
                        .HasForeignKey("CodeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.User", "CreatedBy")
                        .WithMany()
                        .HasForeignKey("CreatedById")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.AttendancePeriod", "AttendancePeriod")
                        .WithMany("AttendanceMarks")
                        .HasForeignKey("PeriodId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("AttendanceMarks")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.AttendanceWeek", "Week")
                        .WithMany("AttendanceMarks")
                        .HasForeignKey("WeekId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("AttendanceCode");

                    b.Navigation("AttendancePeriod");

                    b.Navigation("CreatedBy");

                    b.Navigation("Student");

                    b.Navigation("Week");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AttendancePeriod", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.AttendanceWeekPattern", "WeekPattern")
                        .WithMany("Periods")
                        .HasForeignKey("WeekPatternId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("WeekPattern");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AttendanceWeek", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.AcademicTerm", "AcademicTerm")
                        .WithMany("AttendanceWeeks")
                        .HasForeignKey("AcademicTermId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.AttendanceWeekPattern", "WeekPattern")
                        .WithMany("AttendanceWeeks")
                        .HasForeignKey("WeekPatternId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("AcademicTerm");

                    b.Navigation("WeekPattern");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BasketItem", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Product", "Product")
                        .WithMany("BasketItems")
                        .HasForeignKey("ProductId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("FinanceBasketItems")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Product");

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Bill", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ChargeBillingPeriod", "ChargeBillingPeriod")
                        .WithMany("Bills")
                        .HasForeignKey("ChargeBillingPeriodId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("Bills")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("ChargeBillingPeriod");

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BillAccountTransaction", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.AccountTransaction", "AccountTransaction")
                        .WithMany("BillAccountTransactions")
                        .HasForeignKey("AccountTransactionId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Bill", "Bill")
                        .WithMany("AccountTransactions")
                        .HasForeignKey("BillId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("AccountTransaction");

                    b.Navigation("Bill");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BillDiscount", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Bill", "Bill")
                        .WithMany("BillChargeDiscounts")
                        .HasForeignKey("BillId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Discount", "Discount")
                        .WithMany("BillDiscounts")
                        .HasForeignKey("DiscountId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Bill");

                    b.Navigation("Discount");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BillItem", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Bill", "Bill")
                        .WithMany("BillItems")
                        .HasForeignKey("BillId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Product", "Product")
                        .WithMany("BillItems")
                        .HasForeignKey("ProductId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Bill");

                    b.Navigation("Product");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BillStudentCharge", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Bill", "Bill")
                        .WithMany("BillStudentCharges")
                        .HasForeignKey("BillId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StudentCharge", "StudentCharge")
                        .WithMany("BillStudentCharges")
                        .HasForeignKey("StudentChargeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Bill");

                    b.Navigation("StudentCharge");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BuildingFloor", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Building", "Building")
                        .WithMany("Floors")
                        .HasForeignKey("BuildingId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Building");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Bulletin", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.User", "CreatedBy")
                        .WithMany("Bulletins")
                        .HasForeignKey("CreatedById")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Directory", "Directory")
                        .WithMany("Bulletins")
                        .HasForeignKey("DirectoryId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("CreatedBy");

                    b.Navigation("Directory");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Charge", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.VatRate", "VatRate")
                        .WithMany()
                        .HasForeignKey("VatRateId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("VatRate");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ChargeDiscount", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Charge", "Charge")
                        .WithMany("ChargeDiscounts")
                        .HasForeignKey("ChargeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Discount", "Discount")
                        .WithMany("ChargeDiscounts")
                        .HasForeignKey("DiscountId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Charge");

                    b.Navigation("Discount");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Class", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Course", "Course")
                        .WithMany("Classes")
                        .HasForeignKey("CourseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.CurriculumGroup", "Group")
                        .WithMany("Classes")
                        .HasForeignKey("CurriculumGroupId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Directory", "Directory")
                        .WithMany()
                        .HasForeignKey("DirectoryId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Course");

                    b.Navigation("Directory");

                    b.Navigation("Group");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Comment", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.CommentBankSection", "Section")
                        .WithMany("Comments")
                        .HasForeignKey("CommentBankSectionId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.CommentType", "CommentType")
                        .WithMany("Comments")
                        .HasForeignKey("CommentTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("CommentType");

                    b.Navigation("Section");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CommentBankArea", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.CommentBank", "CommentBank")
                        .WithMany("Areas")
                        .HasForeignKey("CommentBankId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Course", "Course")
                        .WithMany("CommentBankAreas")
                        .HasForeignKey("CourseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("CommentBank");

                    b.Navigation("Course");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CommentBankSection", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.CommentBankArea", "Area")
                        .WithMany("Sections")
                        .HasForeignKey("CommentBankAreaId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Area");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CommunicationLog", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.CommunicationType", "Type")
                        .WithMany("CommunicationLogs")
                        .HasForeignKey("CommunicationTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Contact", "Contact")
                        .WithMany()
                        .HasForeignKey("ContactId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Contact");

                    b.Navigation("Type");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Contact", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Person", "Person")
                        .WithMany("Contacts")
                        .HasForeignKey("PersonId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Person");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Course", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Subject", "Subject")
                        .WithMany("Courses")
                        .HasForeignKey("SubjectId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Subject");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CoverArrangement", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Room", "Room")
                        .WithMany("CoverArrangements")
                        .HasForeignKey("RoomId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.Session", "Session")
                        .WithMany()
                        .HasForeignKey("SessionId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StaffMember", "Teacher")
                        .WithMany("CoverArrangements")
                        .HasForeignKey("TeacherId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.AttendanceWeek", "Week")
                        .WithMany()
                        .HasForeignKey("WeekId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Room");

                    b.Navigation("Session");

                    b.Navigation("Teacher");

                    b.Navigation("Week");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CurriculumBand", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.AcademicYear", "AcademicYear")
                        .WithMany()
                        .HasForeignKey("AcademicYearId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.CurriculumYearGroup", "CurriculumYearGroup")
                        .WithMany("Bands")
                        .HasForeignKey("CurriculumYearGroupId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StudentGroup", "StudentGroup")
                        .WithMany("CurriculumBands")
                        .HasForeignKey("StudentGroupId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("AcademicYear");

                    b.Navigation("CurriculumYearGroup");

                    b.Navigation("StudentGroup");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CurriculumBandBlockAssignment", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.CurriculumBand", "Band")
                        .WithMany("AssignedBlocks")
                        .HasForeignKey("BandId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.CurriculumBlock", "Block")
                        .WithMany("BandAssignments")
                        .HasForeignKey("BlockId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Band");

                    b.Navigation("Block");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CurriculumGroup", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.CurriculumBlock", "Block")
                        .WithMany("Groups")
                        .HasForeignKey("BlockId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StudentGroup", "StudentGroup")
                        .WithMany("CurriculumGroups")
                        .HasForeignKey("StudentGroupId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Block");

                    b.Navigation("StudentGroup");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CurriculumGroupSession", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.CurriculumGroup", "CurriculumGroup")
                        .WithMany("CurriculumGroupSessions")
                        .HasForeignKey("CurriculumGroupId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.SessionType", "SessionType")
                        .WithMany("CurriculumGroupSessions")
                        .HasForeignKey("SessionTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Subject", "Subject")
                        .WithMany("CurriculumGroupSessions")
                        .HasForeignKey("SubjectId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("CurriculumGroup");

                    b.Navigation("SessionType");

                    b.Navigation("Subject");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Detention", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.DetentionType", "Type")
                        .WithMany("Detentions")
                        .HasForeignKey("DetentionTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.DiaryEvent", "Event")
                        .WithMany("Detentions")
                        .HasForeignKey("EventId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StaffMember", "Supervisor")
                        .WithMany("SupervisedDetentions")
                        .HasForeignKey("SupervisorId");

                    b.Navigation("Event");

                    b.Navigation("Supervisor");

                    b.Navigation("Type");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.DiaryEvent", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.User", "CreatedBy")
                        .WithMany("DiaryEvents")
                        .HasForeignKey("CreatedById")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.DiaryEventType", "EventType")
                        .WithMany("DiaryEvents")
                        .HasForeignKey("EventTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Room", "Room")
                        .WithMany("DiaryEvents")
                        .HasForeignKey("RoomId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("CreatedBy");

                    b.Navigation("EventType");

                    b.Navigation("Room");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.DiaryEventAttendee", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.DiaryEvent", "Event")
                        .WithMany("Attendees")
                        .HasForeignKey("EventId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Person", "Person")
                        .WithMany("DiaryEventInvitations")
                        .HasForeignKey("PersonId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.DiaryEventAttendeeResponse", "Response")
                        .WithMany("DiaryEventAttendees")
                        .HasForeignKey("ResponseId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("Event");

                    b.Navigation("Person");

                    b.Navigation("Response");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.DiaryEventTemplate", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.DiaryEventType", "DiaryEventType")
                        .WithMany("DiaryEventTemplates")
                        .HasForeignKey("EventTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("DiaryEventType");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Directory", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Directory", "Parent")
                        .WithMany("Subdirectories")
                        .HasForeignKey("ParentId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("Parent");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Document", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.User", "CreatedBy")
                        .WithMany("Documents")
                        .HasForeignKey("CreatedById")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Directory", "Directory")
                        .WithMany("Documents")
                        .HasForeignKey("DirectoryId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.File", "Attachment")
                        .WithMany("Documents")
                        .HasForeignKey("FileId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.DocumentType", "Type")
                        .WithMany("Documents")
                        .HasForeignKey("TypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Attachment");

                    b.Navigation("CreatedBy");

                    b.Navigation("Directory");

                    b.Navigation("Type");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.EmailAddress", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Agency", "Agency")
                        .WithMany("EmailAddresses")
                        .HasForeignKey("AgencyId");

                    b.HasOne("MyPortal.Database.Models.Entity.Person", "Person")
                        .WithMany("EmailAddresses")
                        .HasForeignKey("PersonId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.EmailAddressType", "Type")
                        .WithMany("EmailAddresses")
                        .HasForeignKey("TypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Agency");

                    b.Navigation("Person");

                    b.Navigation("Type");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamAssessment", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExamBoard", "ExamBoard")
                        .WithMany("ExamAssessments")
                        .HasForeignKey("ExamBoardId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("ExamBoard");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamAssessmentAspect", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Aspect", "Aspect")
                        .WithMany("AssessmentAspects")
                        .HasForeignKey("AspectId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ExamAssessment", "Assessment")
                        .WithMany("Aspects")
                        .HasForeignKey("AssessmentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ExamSeries", "Series")
                        .WithMany("ExamAssessmentAspects")
                        .HasForeignKey("SeriesId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Aspect");

                    b.Navigation("Assessment");

                    b.Navigation("Series");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamAward", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExamAssessment", "Assessment")
                        .WithMany("ExamAwards")
                        .HasForeignKey("AssessmentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Course", "Course")
                        .WithMany("Awards")
                        .HasForeignKey("CourseId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.ExamQualification", "Qualification")
                        .WithMany("Awards")
                        .HasForeignKey("QualificationId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Assessment");

                    b.Navigation("Course");

                    b.Navigation("Qualification");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamAwardElement", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExamAward", "Award")
                        .WithMany("ExamAwardElements")
                        .HasForeignKey("AwardId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ExamElement", "Element")
                        .WithMany("ExamAwardElements")
                        .HasForeignKey("ElementId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Award");

                    b.Navigation("Element");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamAwardSeries", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExamAward", "Award")
                        .WithMany("ExamAwardSeries")
                        .HasForeignKey("AwardId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ExamSeries", "Series")
                        .WithMany("ExamAwardSeries")
                        .HasForeignKey("AwardId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Award");

                    b.Navigation("Series");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamBaseComponent", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExamAssessmentMode", "AssessmentMode")
                        .WithMany("ExamBaseComponents")
                        .HasForeignKey("AssessmentModeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ExamAssessment", "Assessment")
                        .WithMany("ExamBaseComponents")
                        .HasForeignKey("ExamAssessmentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Assessment");

                    b.Navigation("AssessmentMode");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamBaseElement", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExamAssessment", "Assessment")
                        .WithMany("ExamBaseElements")
                        .HasForeignKey("AssessmentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ExamQualificationLevel", "Level")
                        .WithMany("ExamBaseElements")
                        .HasForeignKey("LevelId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.SubjectCode", "QcaCode")
                        .WithMany("Elements")
                        .HasForeignKey("QcaCodeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Assessment");

                    b.Navigation("Level");

                    b.Navigation("QcaCode");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamCandidate", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("ExamCandidates")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamCandidateSeries", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExamCandidate", "Candidate")
                        .WithMany("LinkedSeries")
                        .HasForeignKey("CandidateId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ExamSeries", "Series")
                        .WithMany("ExamCandidateSeries")
                        .HasForeignKey("SeriesId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Candidate");

                    b.Navigation("Series");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamCandidateSpecialArrangement", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExamCandidate", "Candidate")
                        .WithMany("SpecialArrangements")
                        .HasForeignKey("CandidateId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ExamSpecialArrangement", "SpecialArrangement")
                        .WithMany("Candidates")
                        .HasForeignKey("SpecialArrangementId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Candidate");

                    b.Navigation("SpecialArrangement");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamComponent", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExamAssessmentMode", "AssessmentMode")
                        .WithMany("Components")
                        .HasForeignKey("AssessmentModeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ExamBaseComponent", "BaseComponent")
                        .WithMany("ExamComponents")
                        .HasForeignKey("BaseComponentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ExamDate", "ExamDate")
                        .WithMany("ExamComponents")
                        .HasForeignKey("ExamDateId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.ExamSeries", "Series")
                        .WithMany("ExamComponents")
                        .HasForeignKey("ExamSeriesId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("AssessmentMode");

                    b.Navigation("BaseComponent");

                    b.Navigation("ExamDate");

                    b.Navigation("Series");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamComponentSitting", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExamComponent", "Component")
                        .WithMany("Sittings")
                        .HasForeignKey("ComponentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ExamRoom", "Room")
                        .WithMany("ExamComponentSittings")
                        .HasForeignKey("ExamRoomId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Component");

                    b.Navigation("Room");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamDate", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExamSession", "Session")
                        .WithMany("ExamDates")
                        .HasForeignKey("SessionId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Session");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamElement", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExamBaseElement", "BaseElement")
                        .WithMany("Elements")
                        .HasForeignKey("BaseElementId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ExamSeries", "Series")
                        .WithMany("ExamElements")
                        .HasForeignKey("SeriesId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("BaseElement");

                    b.Navigation("Series");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamElementComponent", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExamComponent", "Component")
                        .WithMany("ExamElementComponents")
                        .HasForeignKey("ComponentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ExamElement", "Element")
                        .WithMany("ExamElementComponents")
                        .HasForeignKey("ElementId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Component");

                    b.Navigation("Element");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamEnrolment", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExamAward", "Award")
                        .WithMany("ExamEnrolments")
                        .HasForeignKey("AwardId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ExamCandidate", "Candidate")
                        .WithMany("ExamEnrolments")
                        .HasForeignKey("CandidateId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Award");

                    b.Navigation("Candidate");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamQualificationLevel", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.GradeSet", "DefaultGradeSet")
                        .WithMany("ExamQualificationLevels")
                        .HasForeignKey("DefaultGradeSetId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.ExamQualification", "Qualification")
                        .WithMany("Levels")
                        .HasForeignKey("QualificationId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("DefaultGradeSet");

                    b.Navigation("Qualification");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamResultEmbargo", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ResultSet", "ResultSet")
                        .WithMany("ExamResultEmbargoes")
                        .HasForeignKey("ResultSetId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("ResultSet");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamRoom", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Room", "Room")
                        .WithMany("ExamRooms")
                        .HasForeignKey("RoomId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Room");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamRoomSeatBlock", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExamRoom", "ExamRoom")
                        .WithMany("SeatBlocks")
                        .HasForeignKey("ExamRoomId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("ExamRoom");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamSeason", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ResultSet", "ResultSet")
                        .WithMany("ExamSeasons")
                        .HasForeignKey("ResultSetId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("ResultSet");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamSeatAllocation", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExamCandidate", "Candidate")
                        .WithMany("SeatAllocations")
                        .HasForeignKey("CandidateId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ExamComponentSitting", "Sitting")
                        .WithMany("SeatAllocations")
                        .HasForeignKey("SittingId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Candidate");

                    b.Navigation("Sitting");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamSeries", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExamBoard", "ExamBoard")
                        .WithMany("ExamSeries")
                        .HasForeignKey("ExamBoardId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ExamSeason", "Season")
                        .WithMany("ExamSeries")
                        .HasForeignKey("ExamSeasonId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("ExamBoard");

                    b.Navigation("Season");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Exclusion", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ExclusionAppealResult", "AppealResult")
                        .WithMany("Exclusions")
                        .HasForeignKey("AppealResultId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.ExclusionReason", "ExclusionReason")
                        .WithMany("Exclusions")
                        .HasForeignKey("ExclusionReasonId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ExclusionType", "ExclusionType")
                        .WithMany("Exclusions")
                        .HasForeignKey("ExclusionTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("Exclusions")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("AppealResult");

                    b.Navigation("ExclusionReason");

                    b.Navigation("ExclusionType");

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.GiftedTalented", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("GiftedTalentedSubjects")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Subject", "Subject")
                        .WithMany("GiftedTalentedStudents")
                        .HasForeignKey("SubjectId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Student");

                    b.Navigation("Subject");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Grade", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.GradeSet", "GradeSet")
                        .WithMany("Grades")
                        .HasForeignKey("GradeSetId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("GradeSet");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.HomeworkItem", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Directory", "Directory")
                        .WithMany("HomeworkItems")
                        .HasForeignKey("DirectoryId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Directory");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.HomeworkSubmission", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Document", "SubmittedWork")
                        .WithMany("HomeworkSubmissions")
                        .HasForeignKey("DocumentId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.HomeworkItem", "HomeworkItem")
                        .WithMany("Submissions")
                        .HasForeignKey("HomeworkId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("HomeworkSubmissions")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Task", "Task")
                        .WithMany("HomeworkSubmissions")
                        .HasForeignKey("TaskId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("HomeworkItem");

                    b.Navigation("Student");

                    b.Navigation("SubmittedWork");

                    b.Navigation("Task");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.House", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.StaffMember", null)
                        .WithMany("PastoralHouses")
                        .HasForeignKey("StaffMemberId");

                    b.HasOne("MyPortal.Database.Models.Entity.StudentGroup", "StudentGroup")
                        .WithMany("Houses")
                        .HasForeignKey("StudentGroupId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("StudentGroup");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Incident", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.AcademicYear", "AcademicYear")
                        .WithMany("Incidents")
                        .HasForeignKey("AcademicYearId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.IncidentType", "Type")
                        .WithMany("Incidents")
                        .HasForeignKey("BehaviourTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.User", "CreatedBy")
                        .WithMany("Incidents")
                        .HasForeignKey("CreatedById")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Location", "Location")
                        .WithMany("BehaviourIncidents")
                        .HasForeignKey("LocationId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("AcademicYear");

                    b.Navigation("CreatedBy");

                    b.Navigation("Location");

                    b.Navigation("Type");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.LessonPlan", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.User", "CreatedBy")
                        .WithMany("LessonPlans")
                        .HasForeignKey("CreatedById")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Directory", "Directory")
                        .WithMany("LessonPlans")
                        .HasForeignKey("DirectoryId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StudyTopic", "StudyTopic")
                        .WithMany("LessonPlans")
                        .HasForeignKey("StudyTopicId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("CreatedBy");

                    b.Navigation("Directory");

                    b.Navigation("StudyTopic");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.LessonPlanHomeworkItem", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.HomeworkItem", "HomeworkItem")
                        .WithMany("LessonPlanHomeworkItems")
                        .HasForeignKey("HomeworkItemId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.LessonPlan", "LessonPlan")
                        .WithMany("HomeworkItems")
                        .HasForeignKey("LessonPlanId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("HomeworkItem");

                    b.Navigation("LessonPlan");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.LogNote", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.AcademicYear", "AcademicYear")
                        .WithMany("LogNotes")
                        .HasForeignKey("AcademicYearId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.User", "CreatedBy")
                        .WithMany("LogNotesCreated")
                        .HasForeignKey("CreatedById")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("ProfileLogs")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.LogNoteType", "LogNoteType")
                        .WithMany("LogNotes")
                        .HasForeignKey("TypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("AcademicYear");

                    b.Navigation("CreatedBy");

                    b.Navigation("LogNoteType");

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Marksheet", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.MarksheetTemplate", "Template")
                        .WithMany("Marksheets")
                        .HasForeignKey("MarksheetTemplateId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StudentGroup", "StudentGroup")
                        .WithMany("Marksheets")
                        .HasForeignKey("StudentGroupId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("StudentGroup");

                    b.Navigation("Template");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.MarksheetColumn", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Aspect", "Aspect")
                        .WithMany()
                        .HasForeignKey("AspectId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ResultSet", "ResultSet")
                        .WithMany()
                        .HasForeignKey("ResultSetId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.MarksheetTemplate", "Template")
                        .WithMany("Columns")
                        .HasForeignKey("TemplateId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Aspect");

                    b.Navigation("ResultSet");

                    b.Navigation("Template");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.MedicalEvent", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.User", "CreatedBy")
                        .WithMany("MedicalEvents")
                        .HasForeignKey("CreatedById")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Person", "Person")
                        .WithMany("MedicalEvents")
                        .HasForeignKey("PersonId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("CreatedBy");

                    b.Navigation("Person");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.NextOfKin", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Person", "NextOfKinPerson")
                        .WithMany("RelatedStaff")
                        .HasForeignKey("NextOfKinPersonId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.NextOfKinRelationshipType", "RelationshipType")
                        .WithMany("NextOfKin")
                        .HasForeignKey("RelationshipTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StaffMember", "StaffMember")
                        .WithMany("NextOfKin")
                        .HasForeignKey("StaffMemberId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("NextOfKinPerson");

                    b.Navigation("RelationshipType");

                    b.Navigation("StaffMember");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Observation", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.StaffMember", "Observee")
                        .WithMany("PersonnelObservations")
                        .HasForeignKey("ObserveeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StaffMember", "Observer")
                        .WithMany("PersonnelObservationsObserved")
                        .HasForeignKey("ObserverId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ObservationOutcome", "Outcome")
                        .WithMany("Observations")
                        .HasForeignKey("OutcomeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Observee");

                    b.Navigation("Observer");

                    b.Navigation("Outcome");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ParentEvening", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.DiaryEvent", "Event")
                        .WithMany("ParentEvenings")
                        .HasForeignKey("EventId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Event");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ParentEveningAppointment", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ParentEveningStaffMember", "ParentEveningStaffMember")
                        .WithMany("Appointments")
                        .HasForeignKey("ParentEveningStaffId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("ParentEveningAppointments")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("ParentEveningStaffMember");

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ParentEveningBreak", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ParentEveningStaffMember", "ParentEveningStaffMember")
                        .WithMany("Breaks")
                        .HasForeignKey("ParentEveningStaffMemberId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("ParentEveningStaffMember");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ParentEveningGroup", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ParentEvening", "ParentEvening")
                        .WithMany()
                        .HasForeignKey("ParentEveningId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StudentGroup", "StudentGroup")
                        .WithMany()
                        .HasForeignKey("StudentGroupId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("ParentEvening");

                    b.Navigation("StudentGroup");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ParentEveningStaffMember", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ParentEvening", "ParentEvening")
                        .WithMany("StaffMembers")
                        .HasForeignKey("ParentEveningId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StaffMember", "StaffMember")
                        .WithMany("ParentEvenings")
                        .HasForeignKey("StaffMemberId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("ParentEvening");

                    b.Navigation("StaffMember");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Person", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Directory", "Directory")
                        .WithMany("People")
                        .HasForeignKey("DirectoryId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Ethnicity", "Ethnicity")
                        .WithMany("People")
                        .HasForeignKey("EthnicityId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.Photo", "Photo")
                        .WithMany("People")
                        .HasForeignKey("PhotoId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("Directory");

                    b.Navigation("Ethnicity");

                    b.Navigation("Photo");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.PersonCondition", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.MedicalCondition", "MedicalCondition")
                        .WithMany("PersonConditions")
                        .HasForeignKey("ConditionId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Person", "Person")
                        .WithMany("MedicalConditions")
                        .HasForeignKey("PersonId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("MedicalCondition");

                    b.Navigation("Person");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.PersonDietaryRequirement", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.DietaryRequirement", "DietaryRequirement")
                        .WithMany("PersonDietaryRequirements")
                        .HasForeignKey("DietaryRequirementId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Person", "Person")
                        .WithMany("DietaryRequirements")
                        .HasForeignKey("PersonId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("DietaryRequirement");

                    b.Navigation("Person");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.PhoneNumber", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Agency", "Agency")
                        .WithMany("PhoneNumbers")
                        .HasForeignKey("AgencyId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.Person", "Person")
                        .WithMany("PhoneNumbers")
                        .HasForeignKey("PersonId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.PhoneNumberType", "Type")
                        .WithMany("PhoneNumbers")
                        .HasForeignKey("TypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Agency");

                    b.Navigation("Person");

                    b.Navigation("Type");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Product", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ProductType", "Type")
                        .WithMany("Products")
                        .HasForeignKey("ProductTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.VatRate", "VatRate")
                        .WithMany("Products")
                        .HasForeignKey("VatRateId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Type");

                    b.Navigation("VatRate");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.RegGroup", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.StaffMember", null)
                        .WithMany("PastoralRegGroups")
                        .HasForeignKey("StaffMemberId");

                    b.HasOne("MyPortal.Database.Models.Entity.StudentGroup", "StudentGroup")
                        .WithMany("RegGroups")
                        .HasForeignKey("StudentGroupId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.YearGroup", "YearGroup")
                        .WithMany("RegGroups")
                        .HasForeignKey("YearGroupId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("StudentGroup");

                    b.Navigation("YearGroup");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ReportCard", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.IncidentType", "BehaviourType")
                        .WithMany("ReportCards")
                        .HasForeignKey("BehaviourTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("ReportCards")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("BehaviourType");

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ReportCardEntry", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.AttendanceWeek", "AttendanceWeek")
                        .WithMany("ReportCardSubmissions")
                        .HasForeignKey("AttendanceWeekId");

                    b.HasOne("MyPortal.Database.Models.Entity.User", "CreatedBy")
                        .WithMany("ReportCardSubmissions")
                        .HasForeignKey("CreatedById")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.AttendancePeriod", "Period")
                        .WithMany("ReportCardSubmissions")
                        .HasForeignKey("PeriodId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ReportCard", "ReportCard")
                        .WithMany("Submissions")
                        .HasForeignKey("ReportCardId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("AttendanceWeek");

                    b.Navigation("CreatedBy");

                    b.Navigation("Period");

                    b.Navigation("ReportCard");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ReportCardTarget", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ReportCard", "ReportCard")
                        .WithMany("Targets")
                        .HasForeignKey("ReportCardId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.BehaviourTarget", "Target")
                        .WithMany("ReportCardLinks")
                        .HasForeignKey("TargetId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("ReportCard");

                    b.Navigation("Target");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ReportCardTargetEntry", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ReportCardEntry", "Entry")
                        .WithMany("TargetSubmissions")
                        .HasForeignKey("EntryId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ReportCardTarget", "Target")
                        .WithMany("Submissions")
                        .HasForeignKey("TargetId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Entry");

                    b.Navigation("Target");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Result", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Aspect", "Aspect")
                        .WithMany("Results")
                        .HasForeignKey("AspectId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.User", "CreatedBy")
                        .WithMany("Results")
                        .HasForeignKey("CreatedById")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Grade", "Grade")
                        .WithMany("Results")
                        .HasForeignKey("GradeId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.ResultSet", "ResultSet")
                        .WithMany("Results")
                        .HasForeignKey("ResultSetId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("Results")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Aspect");

                    b.Navigation("CreatedBy");

                    b.Navigation("Grade");

                    b.Navigation("ResultSet");

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.RoleClaim", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Role", "Role")
                        .WithMany("RoleClaims")
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Role");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Room", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.BuildingFloor", "BuildingFloor")
                        .WithMany("Rooms")
                        .HasForeignKey("BuildingFloorId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.Location", null)
                        .WithMany("Rooms")
                        .HasForeignKey("LocationId");

                    b.Navigation("BuildingFloor");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.RoomClosure", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.RoomClosureReason", "Reason")
                        .WithMany("Closures")
                        .HasForeignKey("ReasonId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Room", "Room")
                        .WithMany("Closures")
                        .HasForeignKey("RoomId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Reason");

                    b.Navigation("Room");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.School", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Agency", "Agency")
                        .WithMany("Schools")
                        .HasForeignKey("AgencyId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.GovernanceType", "GovernanceType")
                        .WithMany("Schools")
                        .HasForeignKey("GovernanceTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Person", "HeadTeacher")
                        .WithMany("HeadteacherOf")
                        .HasForeignKey("HeadTeacherId");

                    b.HasOne("MyPortal.Database.Models.Entity.IntakeType", "IntakeType")
                        .WithMany("Schools")
                        .HasForeignKey("IntakeTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.LocalAuthority", "LocalAuthority")
                        .WithMany("Schools")
                        .HasForeignKey("LocalAuthorityId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.SchoolPhase", "SchoolPhase")
                        .WithMany("Schools")
                        .HasForeignKey("PhaseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.SchoolType", "Type")
                        .WithMany("Schools")
                        .HasForeignKey("TypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Agency");

                    b.Navigation("GovernanceType");

                    b.Navigation("HeadTeacher");

                    b.Navigation("IntakeType");

                    b.Navigation("LocalAuthority");

                    b.Navigation("SchoolPhase");

                    b.Navigation("Type");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenEvent", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.SenEventType", "Type")
                        .WithMany("Events")
                        .HasForeignKey("EventTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("SenEvents")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Student");

                    b.Navigation("Type");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenProvision", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.SenProvisionType", "Type")
                        .WithMany("SenProvisions")
                        .HasForeignKey("ProvisionTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("SenProvisions")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Student");

                    b.Navigation("Type");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenReview", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.DiaryEvent", "Event")
                        .WithMany("SenReviews")
                        .HasForeignKey("EventId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.SenStatus", "OutcomeStatus")
                        .WithMany("SenReviews")
                        .HasForeignKey("OutcomeSenStatusId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.SenReviewStatus", "ReviewStatus")
                        .WithMany("SenReviews")
                        .HasForeignKey("ReviewStatusId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.SenReviewType", "ReviewType")
                        .WithMany("Reviews")
                        .HasForeignKey("ReviewTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StaffMember", "Senco")
                        .WithMany("SenReviews")
                        .HasForeignKey("SencoId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("SenReviews")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Event");

                    b.Navigation("OutcomeStatus");

                    b.Navigation("ReviewStatus");

                    b.Navigation("ReviewType");

                    b.Navigation("Senco");

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Session", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Class", "Class")
                        .WithMany("Sessions")
                        .HasForeignKey("ClassId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Room", "Room")
                        .WithMany("Sessions")
                        .HasForeignKey("RoomId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.StaffMember", "Teacher")
                        .WithMany("Sessions")
                        .HasForeignKey("TeacherId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Class");

                    b.Navigation("Room");

                    b.Navigation("Teacher");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SessionExtraName", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.AttendanceWeek", "AttendanceWeek")
                        .WithMany("SessionExtraNames")
                        .HasForeignKey("AttendanceWeekId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Session", "Session")
                        .WithMany("SessionExtraNames")
                        .HasForeignKey("SessionId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("SessionExtraNames")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("AttendanceWeek");

                    b.Navigation("Session");

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SessionPeriod", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.AttendancePeriod", "Period")
                        .WithMany("SessionPeriods")
                        .HasForeignKey("PeriodId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Session", "Session")
                        .WithMany("SessionPeriods")
                        .HasForeignKey("SessionId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Period");

                    b.Navigation("Session");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StaffAbsence", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.StaffAbsenceType", "AbsenceType")
                        .WithMany("Absences")
                        .HasForeignKey("AbsenceTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StaffIllnessType", "IllnessType")
                        .WithMany("Absences")
                        .HasForeignKey("IllnessTypeId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.StaffMember", "StaffMember")
                        .WithMany("Absences")
                        .HasForeignKey("StaffMemberId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("AbsenceType");

                    b.Navigation("IllnessType");

                    b.Navigation("StaffMember");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StaffMember", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.StaffMember", "LineManager")
                        .WithMany("Subordinates")
                        .HasForeignKey("LineManagerId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.Person", "Person")
                        .WithMany("StaffMembers")
                        .HasForeignKey("PersonId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("LineManager");

                    b.Navigation("Person");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StoreDiscount", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Discount", "Discount")
                        .WithMany("ProductDiscounts")
                        .HasForeignKey("DiscountId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Product", "Product")
                        .WithMany("ProductDiscounts")
                        .HasForeignKey("ProductId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.ProductType", "ProductType")
                        .WithMany("ProductTypeDiscounts")
                        .HasForeignKey("ProductTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Discount");

                    b.Navigation("Product");

                    b.Navigation("ProductType");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Student", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.BoarderStatus", "BoarderStatus")
                        .WithMany("Students")
                        .HasForeignKey("BoarderStatusId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.EnrolmentStatus", "EnrolmentStatus")
                        .WithMany("Students")
                        .HasForeignKey("EnrolmentStatusId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.Person", "Person")
                        .WithMany("Students")
                        .HasForeignKey("PersonId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.SenStatus", "SenStatus")
                        .WithMany("Students")
                        .HasForeignKey("SenStatusId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.SenType", "SenType")
                        .WithMany("Students")
                        .HasForeignKey("SenTypeId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("BoarderStatus");

                    b.Navigation("EnrolmentStatus");

                    b.Navigation("Person");

                    b.Navigation("SenStatus");

                    b.Navigation("SenType");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentAchievement", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Achievement", "Achievement")
                        .WithMany("InvolvedStudents")
                        .HasForeignKey("AchievementId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.AchievementOutcome", "Outcome")
                        .WithMany("StudentAchievements")
                        .HasForeignKey("OutcomeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("StudentAchievements")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Achievement");

                    b.Navigation("Outcome");

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentAgentRelationship", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Agent", "Agent")
                        .WithMany("LinkedStudents")
                        .HasForeignKey("AgentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.RelationshipType", "RelationshipType")
                        .WithMany("StudentAgents")
                        .HasForeignKey("RelationshipTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("AgentRelationships")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Agent");

                    b.Navigation("RelationshipType");

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentCharge", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ChargeBillingPeriod", "ChargeBillingPeriod")
                        .WithMany("StudentCharges")
                        .HasForeignKey("ChargeBillingPeriodId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Charge", "Charge")
                        .WithMany("StudentCharges")
                        .HasForeignKey("ChargeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("Charges")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Charge");

                    b.Navigation("ChargeBillingPeriod");

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentChargeDiscount", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.ChargeDiscount", "ChargeDiscount")
                        .WithMany("StudentChargeDiscounts")
                        .HasForeignKey("ChargeDiscountId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("ChargeDiscounts")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("ChargeDiscount");

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentContactRelationship", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Contact", "Contact")
                        .WithMany("LinkedStudents")
                        .HasForeignKey("ContactId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.RelationshipType", "RelationshipType")
                        .WithMany("StudentContacts")
                        .HasForeignKey("RelationshipTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("StudentContacts")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Contact");

                    b.Navigation("RelationshipType");

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentDetention", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Detention", "Detention")
                        .WithMany("Students")
                        .HasForeignKey("DetentionId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StudentIncident", "LinkedIncident")
                        .WithMany("LinkedDetentions")
                        .HasForeignKey("LinkedIncidentId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("Detentions")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Detention");

                    b.Navigation("LinkedIncident");

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentGroup", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.StudentGroupSupervisor", "MainSupervisor")
                        .WithMany("MainGroups")
                        .HasForeignKey("MainSupervisorId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.StudentGroup", "PromoteToGroup")
                        .WithMany("PromotionSourceGroups")
                        .HasForeignKey("PromoteToGroupId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("MainSupervisor");

                    b.Navigation("PromoteToGroup");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentGroupMembership", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.StudentGroup", "StudentGroup")
                        .WithMany("StudentMemberships")
                        .HasForeignKey("StudentGroupId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("StudentGroupMemberships")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Student");

                    b.Navigation("StudentGroup");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentGroupSupervisor", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.StudentGroup", "StudentGroup")
                        .WithMany("StudentGroupSupervisors")
                        .HasForeignKey("StudentGroupId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StaffMember", "Supervisor")
                        .WithMany("StudentGroupSupervisors")
                        .HasForeignKey("SupervisorId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("StudentGroup");

                    b.Navigation("Supervisor");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentIncident", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Incident", "Incident")
                        .WithMany("InvolvedStudents")
                        .HasForeignKey("IncidentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.BehaviourOutcome", "Outcome")
                        .WithMany("StudentIncidents")
                        .HasForeignKey("OutcomeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.BehaviourRoleType", "RoleType")
                        .WithMany("LinkedIncidents")
                        .HasForeignKey("RoleTypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.BehaviourStatus", "Status")
                        .WithMany("StudentIncidents")
                        .HasForeignKey("StatusId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Student", "Student")
                        .WithMany("StudentIncidents")
                        .HasForeignKey("StudentId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Incident");

                    b.Navigation("Outcome");

                    b.Navigation("RoleType");

                    b.Navigation("Status");

                    b.Navigation("Student");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudyTopic", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Course", "Course")
                        .WithMany("StudyTopics")
                        .HasForeignKey("CourseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Course");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Subject", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.SubjectCode", "SubjectCode")
                        .WithMany()
                        .HasForeignKey("SubjectCodeId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("SubjectCode");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SubjectCode", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.SubjectCodeSet", "SubjectCodeSet")
                        .WithMany("SubjectCodes")
                        .HasForeignKey("SubjectCodeSetId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("SubjectCodeSet");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SubjectStaffMember", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.SubjectStaffMemberRole", "Role")
                        .WithMany("StaffMembers")
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StaffMember", "StaffMember")
                        .WithMany("Subjects")
                        .HasForeignKey("StaffMemberId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.Subject", "Subject")
                        .WithMany("StaffMembers")
                        .HasForeignKey("SubjectId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Role");

                    b.Navigation("StaffMember");

                    b.Navigation("Subject");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Task", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Person", "AssignedTo")
                        .WithMany("AssignedTasks")
                        .HasForeignKey("AssignedToId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("MyPortal.Database.Models.Entity.User", "CreatedBy")
                        .WithMany("CreatedTasks")
                        .HasForeignKey("CreatedById")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.TaskType", "Type")
                        .WithMany("Tasks")
                        .HasForeignKey("TypeId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("AssignedTo");

                    b.Navigation("CreatedBy");

                    b.Navigation("Type");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.TaskReminder", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Task", "Task")
                        .WithMany("Reminders")
                        .HasForeignKey("TaskId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Task");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.TrainingCertificate", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.TrainingCourse", "TrainingCourse")
                        .WithMany("Certificates")
                        .HasForeignKey("CourseId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StaffMember", "StaffMember")
                        .WithMany("PersonnelTrainingCertificates")
                        .HasForeignKey("StaffId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.TrainingCertificateStatus", "Status")
                        .WithMany("Certificates")
                        .HasForeignKey("StatusId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("StaffMember");

                    b.Navigation("Status");

                    b.Navigation("TrainingCourse");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.User", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Person", "Person")
                        .WithMany("Users")
                        .HasForeignKey("PersonId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("Person");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.UserClaim", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.User", "User")
                        .WithMany("UserClaims")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("User");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.UserLogin", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.User", "User")
                        .WithMany("UserLogins")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("User");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.UserReminderSetting", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.User", "User")
                        .WithMany("UserReminderSettings")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("User");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.UserRole", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.Role", "Role")
                        .WithMany("UserRoles")
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.User", "User")
                        .WithMany("UserRoles")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Role");

                    b.Navigation("User");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.UserToken", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.User", "User")
                        .WithMany("UserTokens")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("User");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.YearGroup", b =>
                {
                    b.HasOne("MyPortal.Database.Models.Entity.CurriculumYearGroup", "CurriculumYearGroup")
                        .WithMany("YearGroups")
                        .HasForeignKey("CurriculumYearGroupId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("MyPortal.Database.Models.Entity.StaffMember", null)
                        .WithMany("PastoralYearGroups")
                        .HasForeignKey("StaffMemberId");

                    b.HasOne("MyPortal.Database.Models.Entity.StudentGroup", "StudentGroup")
                        .WithMany("YearGroups")
                        .HasForeignKey("StudentGroupId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("CurriculumYearGroup");

                    b.Navigation("StudentGroup");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AcademicTerm", b =>
                {
                    b.Navigation("AttendanceWeeks");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AcademicYear", b =>
                {
                    b.Navigation("AcademicTerms");

                    b.Navigation("Achievements");

                    b.Navigation("Incidents");

                    b.Navigation("LogNotes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AccountTransaction", b =>
                {
                    b.Navigation("BillAccountTransactions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Achievement", b =>
                {
                    b.Navigation("InvolvedStudents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AchievementOutcome", b =>
                {
                    b.Navigation("StudentAchievements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AchievementType", b =>
                {
                    b.Navigation("Achievements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Address", b =>
                {
                    b.Navigation("AddressAgencies");

                    b.Navigation("AddressPeople");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AddressType", b =>
                {
                    b.Navigation("AddressAgencies");

                    b.Navigation("AddressPersons");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Agency", b =>
                {
                    b.Navigation("AddressAgencies");

                    b.Navigation("Agents");

                    b.Navigation("EmailAddresses");

                    b.Navigation("PhoneNumbers");

                    b.Navigation("Schools");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AgencyType", b =>
                {
                    b.Navigation("Agencies");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Agent", b =>
                {
                    b.Navigation("LinkedStudents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AgentType", b =>
                {
                    b.Navigation("Agents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Aspect", b =>
                {
                    b.Navigation("AssessmentAspects");

                    b.Navigation("Results");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AspectType", b =>
                {
                    b.Navigation("Aspects");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AttendanceCode", b =>
                {
                    b.Navigation("AttendanceMarks");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AttendanceCodeType", b =>
                {
                    b.Navigation("Codes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AttendancePeriod", b =>
                {
                    b.Navigation("AttendanceMarks");

                    b.Navigation("ReportCardSubmissions");

                    b.Navigation("SessionPeriods");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AttendanceWeek", b =>
                {
                    b.Navigation("AttendanceMarks");

                    b.Navigation("ReportCardSubmissions");

                    b.Navigation("SessionExtraNames");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.AttendanceWeekPattern", b =>
                {
                    b.Navigation("AttendanceWeeks");

                    b.Navigation("Periods");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BehaviourOutcome", b =>
                {
                    b.Navigation("StudentIncidents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BehaviourRoleType", b =>
                {
                    b.Navigation("LinkedIncidents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BehaviourStatus", b =>
                {
                    b.Navigation("StudentIncidents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BehaviourTarget", b =>
                {
                    b.Navigation("ReportCardLinks");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Bill", b =>
                {
                    b.Navigation("AccountTransactions");

                    b.Navigation("BillChargeDiscounts");

                    b.Navigation("BillItems");

                    b.Navigation("BillStudentCharges");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BoarderStatus", b =>
                {
                    b.Navigation("Students");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Building", b =>
                {
                    b.Navigation("Floors");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.BuildingFloor", b =>
                {
                    b.Navigation("Rooms");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Charge", b =>
                {
                    b.Navigation("ChargeDiscounts");

                    b.Navigation("StudentCharges");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ChargeBillingPeriod", b =>
                {
                    b.Navigation("Bills");

                    b.Navigation("StudentCharges");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ChargeDiscount", b =>
                {
                    b.Navigation("StudentChargeDiscounts");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Class", b =>
                {
                    b.Navigation("Sessions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CommentBank", b =>
                {
                    b.Navigation("Areas");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CommentBankArea", b =>
                {
                    b.Navigation("Sections");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CommentBankSection", b =>
                {
                    b.Navigation("Comments");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CommentType", b =>
                {
                    b.Navigation("Comments");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CommunicationType", b =>
                {
                    b.Navigation("CommunicationLogs");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Contact", b =>
                {
                    b.Navigation("LinkedStudents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Course", b =>
                {
                    b.Navigation("Awards");

                    b.Navigation("Classes");

                    b.Navigation("CommentBankAreas");

                    b.Navigation("StudyTopics");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CurriculumBand", b =>
                {
                    b.Navigation("AssignedBlocks");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CurriculumBlock", b =>
                {
                    b.Navigation("BandAssignments");

                    b.Navigation("Groups");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CurriculumGroup", b =>
                {
                    b.Navigation("Classes");

                    b.Navigation("CurriculumGroupSessions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.CurriculumYearGroup", b =>
                {
                    b.Navigation("Bands");

                    b.Navigation("YearGroups");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Detention", b =>
                {
                    b.Navigation("Students");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.DetentionType", b =>
                {
                    b.Navigation("Detentions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.DiaryEvent", b =>
                {
                    b.Navigation("Attendees");

                    b.Navigation("Detentions");

                    b.Navigation("ParentEvenings");

                    b.Navigation("SenReviews");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.DiaryEventAttendeeResponse", b =>
                {
                    b.Navigation("DiaryEventAttendees");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.DiaryEventType", b =>
                {
                    b.Navigation("DiaryEventTemplates");

                    b.Navigation("DiaryEvents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.DietaryRequirement", b =>
                {
                    b.Navigation("PersonDietaryRequirements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Directory", b =>
                {
                    b.Navigation("Agencies");

                    b.Navigation("Bulletins");

                    b.Navigation("Documents");

                    b.Navigation("HomeworkItems");

                    b.Navigation("LessonPlans");

                    b.Navigation("People");

                    b.Navigation("Subdirectories");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Discount", b =>
                {
                    b.Navigation("BillDiscounts");

                    b.Navigation("ChargeDiscounts");

                    b.Navigation("ProductDiscounts");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Document", b =>
                {
                    b.Navigation("HomeworkSubmissions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.DocumentType", b =>
                {
                    b.Navigation("Documents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.EmailAddressType", b =>
                {
                    b.Navigation("EmailAddresses");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.EnrolmentStatus", b =>
                {
                    b.Navigation("Students");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Ethnicity", b =>
                {
                    b.Navigation("People");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamAssessment", b =>
                {
                    b.Navigation("Aspects");

                    b.Navigation("ExamAwards");

                    b.Navigation("ExamBaseComponents");

                    b.Navigation("ExamBaseElements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamAssessmentMode", b =>
                {
                    b.Navigation("Components");

                    b.Navigation("ExamBaseComponents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamAward", b =>
                {
                    b.Navigation("ExamAwardElements");

                    b.Navigation("ExamAwardSeries");

                    b.Navigation("ExamEnrolments");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamBaseComponent", b =>
                {
                    b.Navigation("ExamComponents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamBaseElement", b =>
                {
                    b.Navigation("Elements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamBoard", b =>
                {
                    b.Navigation("ExamAssessments");

                    b.Navigation("ExamSeries");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamCandidate", b =>
                {
                    b.Navigation("ExamEnrolments");

                    b.Navigation("LinkedSeries");

                    b.Navigation("SeatAllocations");

                    b.Navigation("SpecialArrangements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamComponent", b =>
                {
                    b.Navigation("ExamElementComponents");

                    b.Navigation("Sittings");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamComponentSitting", b =>
                {
                    b.Navigation("SeatAllocations");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamDate", b =>
                {
                    b.Navigation("ExamComponents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamElement", b =>
                {
                    b.Navigation("ExamAwardElements");

                    b.Navigation("ExamElementComponents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamQualification", b =>
                {
                    b.Navigation("Awards");

                    b.Navigation("Levels");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamQualificationLevel", b =>
                {
                    b.Navigation("ExamBaseElements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamRoom", b =>
                {
                    b.Navigation("ExamComponentSittings");

                    b.Navigation("SeatBlocks");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamSeason", b =>
                {
                    b.Navigation("ExamSeries");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamSeries", b =>
                {
                    b.Navigation("ExamAssessmentAspects");

                    b.Navigation("ExamAwardSeries");

                    b.Navigation("ExamCandidateSeries");

                    b.Navigation("ExamComponents");

                    b.Navigation("ExamElements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamSession", b =>
                {
                    b.Navigation("ExamDates");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExamSpecialArrangement", b =>
                {
                    b.Navigation("Candidates");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExclusionAppealResult", b =>
                {
                    b.Navigation("Exclusions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExclusionReason", b =>
                {
                    b.Navigation("Exclusions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ExclusionType", b =>
                {
                    b.Navigation("Exclusions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.File", b =>
                {
                    b.Navigation("Documents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.GovernanceType", b =>
                {
                    b.Navigation("Schools");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Grade", b =>
                {
                    b.Navigation("Results");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.GradeSet", b =>
                {
                    b.Navigation("Aspects");

                    b.Navigation("ExamQualificationLevels");

                    b.Navigation("Grades");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.HomeworkItem", b =>
                {
                    b.Navigation("LessonPlanHomeworkItems");

                    b.Navigation("Submissions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Incident", b =>
                {
                    b.Navigation("InvolvedStudents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.IncidentType", b =>
                {
                    b.Navigation("Incidents");

                    b.Navigation("ReportCards");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.IntakeType", b =>
                {
                    b.Navigation("Schools");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.LessonPlan", b =>
                {
                    b.Navigation("HomeworkItems");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.LocalAuthority", b =>
                {
                    b.Navigation("Schools");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Location", b =>
                {
                    b.Navigation("BehaviourAchievements");

                    b.Navigation("BehaviourIncidents");

                    b.Navigation("Rooms");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.LogNoteType", b =>
                {
                    b.Navigation("LogNotes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.MarksheetTemplate", b =>
                {
                    b.Navigation("Columns");

                    b.Navigation("Marksheets");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.MedicalCondition", b =>
                {
                    b.Navigation("PersonConditions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.NextOfKinRelationshipType", b =>
                {
                    b.Navigation("NextOfKin");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ObservationOutcome", b =>
                {
                    b.Navigation("Observations");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ParentEvening", b =>
                {
                    b.Navigation("StaffMembers");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ParentEveningStaffMember", b =>
                {
                    b.Navigation("Appointments");

                    b.Navigation("Breaks");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Person", b =>
                {
                    b.Navigation("AddressPeople");

                    b.Navigation("Agents");

                    b.Navigation("AssignedTasks");

                    b.Navigation("Contacts");

                    b.Navigation("DiaryEventInvitations");

                    b.Navigation("DietaryRequirements");

                    b.Navigation("EmailAddresses");

                    b.Navigation("HeadteacherOf");

                    b.Navigation("MedicalConditions");

                    b.Navigation("MedicalEvents");

                    b.Navigation("PhoneNumbers");

                    b.Navigation("RelatedStaff");

                    b.Navigation("StaffMembers");

                    b.Navigation("Students");

                    b.Navigation("Users");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.PhoneNumberType", b =>
                {
                    b.Navigation("PhoneNumbers");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Photo", b =>
                {
                    b.Navigation("People");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Product", b =>
                {
                    b.Navigation("BasketItems");

                    b.Navigation("BillItems");

                    b.Navigation("ProductDiscounts");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ProductType", b =>
                {
                    b.Navigation("ProductTypeDiscounts");

                    b.Navigation("Products");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.RelationshipType", b =>
                {
                    b.Navigation("StudentAgents");

                    b.Navigation("StudentContacts");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ReportCard", b =>
                {
                    b.Navigation("Submissions");

                    b.Navigation("Targets");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ReportCardEntry", b =>
                {
                    b.Navigation("TargetSubmissions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ReportCardTarget", b =>
                {
                    b.Navigation("Submissions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.ResultSet", b =>
                {
                    b.Navigation("ExamResultEmbargoes");

                    b.Navigation("ExamSeasons");

                    b.Navigation("Results");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Role", b =>
                {
                    b.Navigation("RoleClaims");

                    b.Navigation("UserRoles");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Room", b =>
                {
                    b.Navigation("Closures");

                    b.Navigation("CoverArrangements");

                    b.Navigation("DiaryEvents");

                    b.Navigation("ExamRooms");

                    b.Navigation("Sessions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.RoomClosureReason", b =>
                {
                    b.Navigation("Closures");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SchoolPhase", b =>
                {
                    b.Navigation("Schools");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SchoolType", b =>
                {
                    b.Navigation("Schools");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenEventType", b =>
                {
                    b.Navigation("Events");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenProvisionType", b =>
                {
                    b.Navigation("SenProvisions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenReviewStatus", b =>
                {
                    b.Navigation("SenReviews");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenReviewType", b =>
                {
                    b.Navigation("Reviews");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenStatus", b =>
                {
                    b.Navigation("SenReviews");

                    b.Navigation("Students");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SenType", b =>
                {
                    b.Navigation("Students");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Session", b =>
                {
                    b.Navigation("SessionExtraNames");

                    b.Navigation("SessionPeriods");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SessionType", b =>
                {
                    b.Navigation("CurriculumGroupSessions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StaffAbsenceType", b =>
                {
                    b.Navigation("Absences");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StaffIllnessType", b =>
                {
                    b.Navigation("Absences");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StaffMember", b =>
                {
                    b.Navigation("Absences");

                    b.Navigation("CoverArrangements");

                    b.Navigation("NextOfKin");

                    b.Navigation("ParentEvenings");

                    b.Navigation("PastoralHouses");

                    b.Navigation("PastoralRegGroups");

                    b.Navigation("PastoralYearGroups");

                    b.Navigation("PersonnelObservations");

                    b.Navigation("PersonnelObservationsObserved");

                    b.Navigation("PersonnelTrainingCertificates");

                    b.Navigation("SenReviews");

                    b.Navigation("Sessions");

                    b.Navigation("StudentGroupSupervisors");

                    b.Navigation("Subjects");

                    b.Navigation("Subordinates");

                    b.Navigation("SupervisedDetentions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Student", b =>
                {
                    b.Navigation("AccountTransactions");

                    b.Navigation("AgentRelationships");

                    b.Navigation("AttendanceMarks");

                    b.Navigation("Bills");

                    b.Navigation("ChargeDiscounts");

                    b.Navigation("Charges");

                    b.Navigation("Detentions");

                    b.Navigation("ExamCandidates");

                    b.Navigation("Exclusions");

                    b.Navigation("FinanceBasketItems");

                    b.Navigation("GiftedTalentedSubjects");

                    b.Navigation("HomeworkSubmissions");

                    b.Navigation("ParentEveningAppointments");

                    b.Navigation("ProfileLogs");

                    b.Navigation("ReportCards");

                    b.Navigation("Results");

                    b.Navigation("SenEvents");

                    b.Navigation("SenProvisions");

                    b.Navigation("SenReviews");

                    b.Navigation("SessionExtraNames");

                    b.Navigation("StudentAchievements");

                    b.Navigation("StudentContacts");

                    b.Navigation("StudentGroupMemberships");

                    b.Navigation("StudentIncidents");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentCharge", b =>
                {
                    b.Navigation("BillStudentCharges");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentGroup", b =>
                {
                    b.Navigation("Activities");

                    b.Navigation("CurriculumBands");

                    b.Navigation("CurriculumGroups");

                    b.Navigation("Houses");

                    b.Navigation("Marksheets");

                    b.Navigation("PromotionSourceGroups");

                    b.Navigation("RegGroups");

                    b.Navigation("StudentGroupSupervisors");

                    b.Navigation("StudentMemberships");

                    b.Navigation("YearGroups");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentGroupSupervisor", b =>
                {
                    b.Navigation("MainGroups");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudentIncident", b =>
                {
                    b.Navigation("LinkedDetentions");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.StudyTopic", b =>
                {
                    b.Navigation("LessonPlans");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Subject", b =>
                {
                    b.Navigation("Courses");

                    b.Navigation("CurriculumGroupSessions");

                    b.Navigation("GiftedTalentedStudents");

                    b.Navigation("StaffMembers");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SubjectCode", b =>
                {
                    b.Navigation("Elements");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SubjectCodeSet", b =>
                {
                    b.Navigation("SubjectCodes");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.SubjectStaffMemberRole", b =>
                {
                    b.Navigation("StaffMembers");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.Task", b =>
                {
                    b.Navigation("HomeworkSubmissions");

                    b.Navigation("Reminders");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.TaskType", b =>
                {
                    b.Navigation("Tasks");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.TrainingCertificateStatus", b =>
                {
                    b.Navigation("Certificates");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.TrainingCourse", b =>
                {
                    b.Navigation("Certificates");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.User", b =>
                {
                    b.Navigation("Achievements");

                    b.Navigation("Bulletins");

                    b.Navigation("CreatedTasks");

                    b.Navigation("DiaryEvents");

                    b.Navigation("Documents");

                    b.Navigation("Incidents");

                    b.Navigation("LessonPlans");

                    b.Navigation("LogNotesCreated");

                    b.Navigation("MedicalEvents");

                    b.Navigation("ReportCardSubmissions");

                    b.Navigation("Results");

                    b.Navigation("UserClaims");

                    b.Navigation("UserLogins");

                    b.Navigation("UserReminderSettings");

                    b.Navigation("UserRoles");

                    b.Navigation("UserTokens");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.VatRate", b =>
                {
                    b.Navigation("Products");
                });

            modelBuilder.Entity("MyPortal.Database.Models.Entity.YearGroup", b =>
                {
                    b.Navigation("RegGroups");
                });
#pragma warning restore 612, 618
        }
    }
}
