//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using PostFundManagement.Infrastructure.Database;
#nullable disable
namespace PostFundManagement.Infrastructure.Database.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20260923052735_OptimisedMultitenancy")]
partial class OptimisedMultitenancy
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.12")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("PostFundManagement.Domain.Entities.Activity", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Amount")
.HasColumnType("numeric");
b.Property("ApprovedBy")
.HasColumnType("uuid");
b.Property("ApproverId")
.HasColumnType("uuid");
b.Property("Category")
.HasColumnType("text");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CreatorId")
.HasColumnType("uuid");
b.Property("Description")
.HasColumnType("text");
b.Property("MilestoneId")
.HasColumnType("bigint");
b.Property("PerformedAt")
.HasColumnType("timestamp with time zone");
b.Property("ProjectId")
.HasColumnType("bigint");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("bigint");
b.Property("Title")
.HasColumnType("text");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.Property("UpdatorId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ApproverId");
b.HasIndex("CreatorId");
b.HasIndex("MilestoneId");
b.HasIndex("ProjectId");
b.HasIndex("TenantId");
b.HasIndex("UpdatorId");
b.ToTable("Activities");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.AuditLog", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Action")
.HasColumnType("text");
b.Property("EntityId")
.HasColumnType("text");
b.Property("EntityName")
.HasColumnType("text");
b.Property("PerformedBy")
.HasColumnType("uuid");
b.Property("TenantId")
.HasColumnType("bigint");
b.Property("Timestamp")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("AuditLogs");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.Award", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Amount")
.HasColumnType("numeric");
b.Property("ApprovedBy")
.HasColumnType("uuid");
b.Property("ApproverId")
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CreatorId")
.HasColumnType("uuid");
b.Property("OrganisationId")
.HasColumnType("bigint");
b.Property("ProgrammeId")
.HasColumnType("bigint");
b.Property("ProjectId")
.HasColumnType("bigint");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("bigint");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.Property("UpdatorId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ApproverId");
b.HasIndex("CreatorId");
b.HasIndex("OrganisationId");
b.HasIndex("ProgrammeId");
b.HasIndex("ProjectId");
b.HasIndex("TenantId");
b.HasIndex("UpdatorId");
b.ToTable("Awards");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.Beneficiary", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Category")
.HasColumnType("text");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("Location")
.HasColumnType("text");
b.Property("Name")
.HasColumnType("text");
b.Property("ProjectId")
.HasColumnType("bigint");
b.Property("ReachedCount")
.HasColumnType("integer");
b.Property("TargetCount")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("bigint");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("CreatedBy");
b.HasIndex("ProjectId");
b.HasIndex("TenantId");
b.HasIndex("UserId");
b.ToTable("Beneficiaries");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.Budget", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Amount")
.HasColumnType("numeric");
b.Property("ApprovedBy")
.HasColumnType("uuid");
b.Property("ApproverId")
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CreatorId")
.HasColumnType("uuid");
b.Property("Name")
.HasColumnType("text");
b.Property("ProjectId")
.HasColumnType("bigint");
b.Property("TenantId")
.HasColumnType("bigint");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ApproverId");
b.HasIndex("CreatorId");
b.HasIndex("ProjectId");
b.HasIndex("TenantId");
b.ToTable("Budgets");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.ChangeRequest", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ApprovedBy")
.HasColumnType("uuid");
b.Property("ApproverId")
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CreatorId")
.HasColumnType("uuid");
b.Property("Justification")
.HasColumnType("text");
b.Property("ProjectId")
.HasColumnType("bigint");
b.Property("RevisedBudget")
.HasColumnType("numeric");
b.Property("RevisedEndedAt")
.HasColumnType("timestamp with time zone");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("bigint");
b.Property("Title")
.HasColumnType("text");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ApproverId");
b.HasIndex("CreatorId");
b.HasIndex("ProjectId");
b.HasIndex("TenantId");
b.ToTable("ChangeRequests");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.ComplianceItem", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CreatorId")
.HasColumnType("uuid");
b.Property("ProjectId")
.HasColumnType("bigint");
b.Property("Requirements")
.HasColumnType("text");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("bigint");
b.Property("Title")
.HasColumnType("text");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("VerifiedBy")
.HasColumnType("uuid");
b.Property("VerifierId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("CreatorId");
b.HasIndex("ProjectId");
b.HasIndex("TenantId");
b.HasIndex("VerifierId");
b.ToTable("ComplianceItems");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.Contract", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AwardId")
.HasColumnType("bigint");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CreatorId")
.HasColumnType("uuid");
b.Property("EffectiveAt")
.HasColumnType("timestamp with time zone");
b.Property("ExpiresAt")
.HasColumnType("timestamp with time zone");
b.Property("ExternalSignatureId")
.HasColumnType("text");
b.Property("SignedDocumentUrl")
.HasColumnType("text");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("bigint");
b.Property("TotalValue")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("AwardId")
.IsUnique();
b.HasIndex("CreatorId");
b.HasIndex("TenantId");
b.ToTable("Contracts");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.Disbursement", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Amount")
.HasColumnType("numeric");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CreatorId")
.HasColumnType("uuid");
b.Property("MilestoneId")
.HasColumnType("bigint");
b.Property("ProjectId")
.HasColumnType("bigint");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("bigint");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.Property("UpdatorId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("CreatorId");
b.HasIndex("MilestoneId");
b.HasIndex("ProjectId");
b.HasIndex("TenantId");
b.HasIndex("UpdatorId");
b.ToTable("Disbursements");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.Evidence", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ActivityId")
.HasColumnType("bigint");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CreatorId")
.HasColumnType("uuid");
b.Property("DocumentUrl")
.HasColumnType("text");
b.Property("IndicatorId")
.HasColumnType("bigint");
b.Property("MilestoneId")
.HasColumnType("bigint");
b.Property("ProjectId")
.HasColumnType("bigint");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("bigint");
b.Property("Type")
.HasColumnType("integer");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.Property("UpdatorId")
.HasColumnType("uuid");
b.Property("Version")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ActivityId");
b.HasIndex("CreatorId");
b.HasIndex("IndicatorId");
b.HasIndex("MilestoneId");
b.HasIndex("ProjectId");
b.HasIndex("TenantId");
b.HasIndex("UpdatorId");
b.ToTable("Evidences");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.Indicator", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ActualAmount")
.HasColumnType("numeric");
b.Property("BaselineAmount")
.HasColumnType("numeric");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CreatorId")
.HasColumnType("uuid");
b.Property("Name")
.HasColumnType("text");
b.Property("ProjectId")
.HasColumnType("bigint");
b.Property("TargetAmount")
.HasColumnType("numeric");
b.Property("TenantId")
.HasColumnType("bigint");
b.Property("UnitOfMeasure")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CreatorId");
b.HasIndex("ProjectId");
b.HasIndex("TenantId");
b.ToTable("Indicators");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.Instrument", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Code")
.HasColumnType("text");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CreatorId")
.HasColumnType("uuid");
b.Property("Description")
.HasColumnType("text");
b.Property("Name")
.HasColumnType("text");
b.Property("ProgrammeId")
.HasColumnType("bigint");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("CreatorId");
b.HasIndex("ProgrammeId");
b.HasIndex("TenantId");
b.ToTable("Instruments");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.Invite", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AwardId")
.HasColumnType("bigint");
b.Property("ContractId")
.HasColumnType("bigint");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("InvitedOrganisationId")
.HasColumnType("bigint");
b.Property("OrganisationId")
.HasColumnType("bigint");
b.Property("Recipient")
.HasColumnType("uuid");
b.Property("RecipientUserId")
.HasColumnType("uuid");
b.Property("TenantId")
.HasColumnType("bigint");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("AwardId");
b.HasIndex("ContractId");
b.HasIndex("InvitedOrganisationId");
b.HasIndex("OrganisationId");
b.HasIndex("RecipientUserId");
b.HasIndex("TenantId");
b.ToTable("Invites");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.Issue", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AssignedTo")
.HasColumnType("uuid");
b.Property("AssigneeId")
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CreatorId")
.HasColumnType("uuid");
b.Property("Description")
.HasColumnType("text");
b.Property("Priority")
.HasColumnType("integer");
b.Property("ProjectId")
.HasColumnType("bigint");
b.Property("Resolution")
.HasColumnType("text");
b.Property("ResolvedAt")
.HasColumnType("timestamp with time zone");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("bigint");
b.Property("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("AssigneeId");
b.HasIndex("CreatorId");
b.HasIndex("ProjectId");
b.HasIndex("TenantId");
b.ToTable("Issues");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.Milestone", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CreatorId")
.HasColumnType("uuid");
b.Property("DueAt")
.HasColumnType("timestamp with time zone");
b.Property("Name")
.HasColumnType("text");
b.Property("Priority")
.HasColumnType("integer");
b.Property("ProjectId")
.HasColumnType("bigint");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("bigint");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UpdatedBy")
.HasColumnType("uuid");
b.Property("UpdatorId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("CreatorId");
b.HasIndex("ProjectId");
b.HasIndex("TenantId");
b.HasIndex("UpdatorId");
b.ToTable("Milestones");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.Notification", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Destination")
.HasColumnType("text");
b.Property("Error")
.HasColumnType("text");
b.Property("Message")
.HasColumnType("text");
b.Property("OrganisationId")
.HasColumnType("bigint");
b.Property("Platform")
.HasColumnType("integer");
b.Property("Recipient")
.HasColumnType("uuid");
b.Property("RecipientUserId")
.HasColumnType("uuid");
b.Property("SentAt")
.HasColumnType("timestamp with time zone");
b.Property("Status")
.HasColumnType("integer");
b.Property("Subject")
.HasColumnType("text");
b.Property("TenantId")
.HasColumnType("bigint");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("OrganisationId");
b.HasIndex("RecipientUserId");
b.HasIndex("TenantId");
b.ToTable("Notifications");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.Organisation", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CreatorId")
.HasColumnType("uuid");
b.Property("Email")
.HasColumnType("text");
b.Property("Name")
.HasColumnType("text");
b.Property("RegistrationNo")
.HasColumnType("text");
b.Property("Status")
.HasColumnType("integer");
b.Property("Type")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CreatorId");
b.ToTable("Organisations");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.Outcome", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("BeneficiaryId")
.HasColumnType("bigint");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CreatorId")
.HasColumnType("uuid");
b.Property("Description")
.HasColumnType("text");
b.Property("Name")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("BeneficiaryId");
b.HasIndex("CreatorId");
b.ToTable("Outcomes");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.Portfolio", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CreatorId")
.HasColumnType("uuid");
b.Property("Description")
.HasColumnType("text");
b.Property("Name")
.HasColumnType("text");
b.Property("OrganisationId")
.HasColumnType("bigint");
b.Property("OwnedBy")
.HasColumnType("uuid");
b.Property("OwnerId")
.HasColumnType("uuid");
b.Property("TenantId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("CreatorId");
b.HasIndex("OrganisationId");
b.HasIndex("OwnerId");
b.HasIndex("TenantId");
b.ToTable("Portfolios");
});
modelBuilder.Entity("PostFundManagement.Domain.Entities.Programme", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedBy")
.HasColumnType("uuid");
b.Property("CreatorId")
.HasColumnType("uuid");
b.Property("Name")
.HasColumnType("text");
b.Property("OwnedBy")
.HasColumnType("uuid");
b.Property