diff --git a/pfm.dbml b/pfm.dbml new file mode 100644 index 0000000..7df0882 --- /dev/null +++ b/pfm.dbml @@ -0,0 +1,349 @@ +Table "AuditLogs" { + "Id" int8 [not null] + "EntityName" varchar(128) [not null] + "EntityId" int8 [not null] + "Action" varchar(64) [not null] + "Changes" jsonb + "PerformedBy" uuid [not null] + "Timestamp" timestamptz [not null] +} + +Table "Awards" { + "Id" int8 [not null] + "OrganisationId" int8 [not null] + "ProgrammeId" int8 [not null] + "ProjectId" int8 + "CreatedBy" uuid [not null] + "UpdatedBy" uuid + "ApprovedBy" uuid + "CreatedAt" timestamptz [not null] + "UpdatedAt" timestamptz + "Status" int4 [not null] + "Amount" numeric(18,2) [not null] +} + +Table "Beneficiaries" { + "Id" int8 [not null] + "AwardId" int8 [not null] + "CreatedBy" uuid [not null] + "CreatedAt" timestamptz [not null] + "Name" varchar(256) [not null] + "Category" varchar(128) [not null] + "TargetCount" int4 [not null] + "ReachedCount" int4 [not null] + "Location" varchar(256) [not null] +} + +Table "ChangeRequests" { + "Id" int8 [not null] + "ProjectId" int8 [not null] + "Title" varchar(256) [not null] + "Justification" text [not null] + "RevisedBudget" numeric(18,2) + "RevisedEndDate" timestamptz + "Status" int4 [not null] + "CreatedBy" uuid [not null] + "ApprovedBy" uuid + "CreatedAt" timestamptz [not null] + "UpdatedAt" timestamptz +} + +Table "ComplianceItems" { + "Id" int8 [not null] + "ProjectId" int8 [not null] + "Title" varchar(256) [not null] + "Requirements" text [not null] + "Status" int4 [not null] + "CreatedBy" uuid [not null] + "VerifiedBy" uuid + "CreatedAt" timestamptz [not null] + "UpdatedBy" uuid +} + +Table "Contracts" { + "Id" int8 [not null] + "AwardId" int8 [not null] + "ExternalSignatureId" varchar(256) + "SignedDocumentUrl" varchar(2048) + "EffectiveAt" timestamptz + "ExpiresAt" timestamptz + "TotalValue" numeric(18,2) [not null] + "Status" int4 [not null] + "CreatedBy" uuid [not null] + "CreatedAt" timestamptz [not null] +} + +Table "Disbursements" { + "Id" int8 [not null] + "ProjectId" int8 [not null] + "CreatedBy" uuid [not null] + "ApprovedBy" uuid + "CreatedOn" timestamptz [not null] + "UpdatedBy" uuid + "Amount" numeric(18,2) [not null] +} + +Table "Evidences" { + "Id" int8 [not null] + "ProjectId" int8 [not null] + "MilestoneId" int8 + "IndicatorId" int8 + "CreatedBy" uuid [not null] + "UpdatedBy" uuid + "CreatedAt" timestamptz [not null] + "UpdatedAt" timestamptz + "Version" int4 [not null] + "DocumentUrl" text [not null] + "Status" int4 [not null] +} + +Table "Indicators" { + "Id" int8 [not null] + "ProjectId" int8 [not null] + "CreatedBy" uuid [not null] + "CreatedAt" timestamptz [not null] + "Name" varchar(256) [not null] + "UnitOfMeasure" varchar(64) [not null] + "BaselineAmount" numeric(18,2) [not null] + "TargetAmount" numeric(18,2) [not null] + "ActualAmount" numeric(18,2) [not null] +} + +Table "Instruments" { + "Id" int8 [not null] + "Code" varchar(32) [not null] + "Name" varchar(256) [not null] + "Description" text + "Status" int4 [not null] + "CreatedBy" uuid [not null] + "CreatedAt" timestamptz [not null] +} + +Table "Issues" { + "Id" int8 [not null] + "ProjectId" int8 [not null] + "Title" varchar(256) [not null] + "Description" varchar(1024) [not null] + "Priority" int4 [not null] + "Status" int4 [not null] + "CreatedBy" uuid [not null] + "CreatedAt" timestamptz [not null] + "ResolvedAt" timestamptz +} + +Table "Milestones" { + "Id" int8 [not null] + "ProjectId" int8 [not null] + "CreatedBy" uuid [not null] + "UpdatedBy" uuid + "CreatedAt" timestamptz [not null] + "UpdatedAt" timestamptz + "DueDate" timestamptz [not null] + "Name" varchar(256) [not null] + "Status" int4 [not null] +} + +Table "Organisations" { + "Id" int8 [not null] + "CreatedBy" uuid [not null] + "CreatedAt" timestamptz [not null] + "RegistrationNo" varchar(128) [not null] + "Name" varchar(256) [not null] + "Email" varchar(256) [not null] + "Type" int4 [not null] + "Status" int4 [not null] +} + +Table "Outcomes" { + "Id" int8 [not null] + "BeneficiaryId" int8 [not null] + "CreatedBy" uuid [not null] + "CreatedAt" timestamptz [not null] + "Name" varchar(256) [not null] + "Description" text [not null] +} + +Table "Portfolios" { + "Id" int8 [not null] + "CreatedBy" uuid [not null] + "OwnedBy" uuid + "CreatedAt" timestamptz [not null] + "Name" varchar(256) [not null] + "Description" varchar(1024) +} + +Table "Programmes" { + "Id" int8 [not null] + "PortfolioId" int8 [not null] + "InstrumentId" int8 [not null] + "OwnedBy" uuid [not null] + "CreatedBy" uuid [not null] + "UpdatedBy" uuid + "CreatedAt" timestamptz [not null] + "UpdatedAt" timestamptz + "Name" varchar(256) [not null] + "Status" int4 [not null] +} + +Table "Projects" { + "Id" int8 [not null] + "ProgrammeId" int8 [not null] + "CreatedBy" uuid [not null] + "UpdatedBy" uuid + "CreatedAt" timestamptz [not null] + "UpdatedAt" timestamptz + "Name" varchar(256) [not null] + "Description" varchar(1024) + "Status" int4 [not null] +} + +Table "Risks" { + "Id" int8 [not null] + "ProjectId" int8 [not null] + "CreatedBy" uuid [not null] + "CreatedAt" timestamptz [not null] + "Likelihood" int4 [not null] + "Impact" int4 [not null] + "Name" varchar(256) [not null] + "Description" varchar(1024) [not null] +} + +Table "Rules" { + "Id" int8 [not null] + "ProgrammeId" int8 [not null] + "CreatedBy" uuid [not null] + "ApprovedBy" uuid + "CreatedAt" timestamptz [not null] + "UpdatedBy" uuid + "Name" varchar(256) [not null] + "Notes" text [not null] + "Status" int4 [not null] +} + +Table "SiteVisits" { + "Id" int8 [not null] + "ProjectId" int8 [not null] + "VisitedAt" timestamptz [not null] + "InspectorName" varchar(256) [not null] + "Findings" text [not null] + "Status" int4 [not null] + "CreatedBy" uuid [not null] + "CreatedAt" timestamptz [not null] +} + +Table "Users" { + "Id" uuid [not null] + "Firstnames" text [not null] + "Surname" text [not null] + "Status" int4 [not null] +} + +Ref "FK_AuditLogs_Users_PerformedBy":"Users"."Id" < "AuditLogs"."PerformedBy" [delete: restrict] + +Ref "FK_Awards_Organisations_OrganisationId":"Organisations"."Id" < "Awards"."OrganisationId" [delete: restrict] + +Ref "FK_Awards_Programmes_ProgrammeId":"Programmes"."Id" < "Awards"."ProgrammeId" [delete: restrict] + +Ref "FK_Awards_Projects_ProjectId":"Projects"."Id" < "Awards"."ProjectId" [delete: set null] + +Ref "FK_Awards_Users_ApprovedBy":"Users"."Id" < "Awards"."ApprovedBy" + +Ref "FK_Awards_Users_CreatedBy":"Users"."Id" < "Awards"."CreatedBy" + +Ref "FK_Awards_Users_UpdatedBy":"Users"."Id" < "Awards"."UpdatedBy" + +Ref "FK_Beneficiaries_Awards_AwardId":"Awards"."Id" < "Beneficiaries"."AwardId" [delete: restrict] + +Ref "FK_Beneficiaries_Users_CreatedBy":"Users"."Id" < "Beneficiaries"."CreatedBy" + +Ref "FK_ChangeRequests_Projects_ProjectId":"Projects"."Id" < "ChangeRequests"."ProjectId" [delete: restrict] + +Ref "FK_ChangeRequests_Users_ApprovedBy":"Users"."Id" < "ChangeRequests"."ApprovedBy" + +Ref "FK_ChangeRequests_Users_CreatedBy":"Users"."Id" < "ChangeRequests"."CreatedBy" + +Ref "FK_ComplianceItems_Projects_ProjectId":"Projects"."Id" < "ComplianceItems"."ProjectId" [delete: restrict] + +Ref "FK_ComplianceItems_Users_CreatedBy":"Users"."Id" < "ComplianceItems"."CreatedBy" + +Ref "FK_ComplianceItems_Users_VerifiedBy":"Users"."Id" < "ComplianceItems"."VerifiedBy" + +Ref "FK_Contracts_Awards_AwardId":"Awards"."Id" < "Contracts"."AwardId" [delete: restrict] + +Ref "FK_Contracts_Users_CreatedBy":"Users"."Id" < "Contracts"."CreatedBy" + +Ref "FK_Disbursements_Projects_ProjectId":"Projects"."Id" < "Disbursements"."ProjectId" [delete: restrict] + +Ref "FK_Disbursements_Users_ApprovedBy":"Users"."Id" < "Disbursements"."ApprovedBy" + +Ref "FK_Disbursements_Users_CreatedBy":"Users"."Id" < "Disbursements"."CreatedBy" + +Ref "FK_Disbursements_Users_UpdatedBy":"Users"."Id" < "Disbursements"."UpdatedBy" + +Ref "FK_Evidences_Indicators_IndicatorId":"Indicators"."Id" < "Evidences"."IndicatorId" + +Ref "FK_Evidences_Milestones_MilestoneId":"Milestones"."Id" < "Evidences"."MilestoneId" + +Ref "FK_Evidences_Projects_ProjectId":"Projects"."Id" < "Evidences"."ProjectId" [delete: restrict] + +Ref "FK_Evidences_Users_CreatedBy":"Users"."Id" < "Evidences"."CreatedBy" + +Ref "FK_Evidences_Users_UpdatedBy":"Users"."Id" < "Evidences"."UpdatedBy" + +Ref "FK_Indicators_Projects_ProjectId":"Projects"."Id" < "Indicators"."ProjectId" [delete: restrict] + +Ref "FK_Indicators_Users_CreatedBy":"Users"."Id" < "Indicators"."CreatedBy" + +Ref "FK_Instruments_Users_CreatedBy":"Users"."Id" < "Instruments"."CreatedBy" + +Ref "FK_Issues_Projects_ProjectId":"Projects"."Id" < "Issues"."ProjectId" [delete: restrict] + +Ref "FK_Issues_Users_CreatedBy":"Users"."Id" < "Issues"."CreatedBy" + +Ref "FK_Milestones_Projects_ProjectId":"Projects"."Id" < "Milestones"."ProjectId" [delete: restrict] + +Ref "FK_Milestones_Users_CreatedBy":"Users"."Id" < "Milestones"."CreatedBy" + +Ref "FK_Milestones_Users_UpdatedBy":"Users"."Id" < "Milestones"."UpdatedBy" + +Ref "FK_Organisations_Users_CreatedBy":"Users"."Id" < "Organisations"."CreatedBy" + +Ref "FK_Outcomes_Beneficiaries_BeneficiaryId":"Beneficiaries"."Id" < "Outcomes"."BeneficiaryId" [delete: restrict] + +Ref "FK_Outcomes_Users_CreatedBy":"Users"."Id" < "Outcomes"."CreatedBy" + +Ref "FK_Portfolios_Users_CreatedBy":"Users"."Id" < "Portfolios"."CreatedBy" + +Ref "FK_Portfolios_Users_OwnedBy":"Users"."Id" < "Portfolios"."OwnedBy" + +Ref "FK_Programmes_Instruments_InstrumentId":"Instruments"."Id" < "Programmes"."InstrumentId" [delete: restrict] + +Ref "FK_Programmes_Portfolios_PortfolioId":"Portfolios"."Id" < "Programmes"."PortfolioId" [delete: restrict] + +Ref "FK_Programmes_Users_CreatedBy":"Users"."Id" < "Programmes"."CreatedBy" + +Ref "FK_Programmes_Users_OwnedBy":"Users"."Id" < "Programmes"."OwnedBy" [delete: restrict] + +Ref "FK_Programmes_Users_UpdatedBy":"Users"."Id" < "Programmes"."UpdatedBy" + +Ref "FK_Projects_Programmes_ProgrammeId":"Programmes"."Id" < "Projects"."ProgrammeId" [delete: restrict] + +Ref "FK_Projects_Users_CreatedBy":"Users"."Id" < "Projects"."CreatedBy" + +Ref "FK_Projects_Users_UpdatedBy":"Users"."Id" < "Projects"."UpdatedBy" + +Ref "FK_Risks_Projects_ProjectId":"Projects"."Id" < "Risks"."ProjectId" [delete: restrict] + +Ref "FK_Risks_Users_CreatedBy":"Users"."Id" < "Risks"."CreatedBy" + +Ref "FK_Rules_Programmes_ProgrammeId":"Programmes"."Id" < "Rules"."ProgrammeId" [delete: restrict] + +Ref "FK_Rules_Users_ApprovedBy":"Users"."Id" < "Rules"."ApprovedBy" + +Ref "FK_Rules_Users_CreatedBy":"Users"."Id" < "Rules"."CreatedBy" + +Ref "FK_Rules_Users_UpdatedBy":"Users"."Id" < "Rules"."UpdatedBy" + +Ref "FK_SiteVisits_Projects_ProjectId":"Projects"."Id" < "SiteVisits"."ProjectId" [delete: restrict] + +Ref "FK_SiteVisits_Users_CreatedBy":"Users"."Id" < "SiteVisits"."CreatedBy"