Skip to main content

Payroll Database Ownership and Boundaries

Summary​

Ownership boundaries between Payroll persistence, projections, legacy sources, and external systems.

Audience​

Payroll developers, QA and support engineers, solution and security architects, and implementation partners.

Purpose​

Define what Payroll persists and where confirmed responsibility stops.

Ownership​

PayrollDbContext owns payroll periods, runs, details, calculations, payslips, adjustments, advances, overtime, salary components, statutory settings, audit/timeline evidence, workforce and input projections, processed-event markers, and outbox messages.

Lifecycle​

Native commands write Payroll records. Inbound events and backfill populate local projections. Compatibility operations write the same Payroll context while preserving legacy-facing identifiers and contracts.

Persisted fields​

Storage is grouped into lifecycle identifiers and status, period coordinates, employee references, outcome summaries, effective dates, audit metadata, event metadata, and structured calculation/payslip details.

Relationships​

Logical identifiers connect records, but the EF model does not declare foreign keys. Source systems remain authoritative for upstream workforce, attendance, leave, and expense facts; Payroll owns only its local projections and computed outputs.

Constraints​

Ownership is enforced primarily through service code, tenant predicates, global filters, and selected unique indexes—not database relationships.

Indexes​

Indexes are defined around tenant/period, tenant/employee, run/employee, event identity, status/time, and evidence chronology query patterns.

Tenant behavior​

Tenant-owned records normally use the context filter. Filter-bypassing code paths add explicit tenant predicates; their completeness requires ongoing source review.

Audit behavior​

Selected commands, reports, projections, and backfill actions write audit evidence. Timeline entries are used for employee/run chronology, not as a universal change journal.

Integration usage​

The monolith reader is read-only during backfill. Payroll projections are local copies, and external services are not part of the Payroll database transaction.

Known limitations​

System-of-record ownership is Transitional during compatibility and backfill. Physical database ownership and deployment topology are intentionally excluded.

Requires confirmation​

  • Final retirement point for monolith-compatible persistence paths.
  • Formal data stewardship and retention ownership per object family.
  • Whether database permissions independently enforce the service boundary.

Source References​

  • microservices/src/payroll-service/Infrastructure/PayrollDbContext.cs
  • microservices/src/payroll-service/Domain/PayrollEntities.cs
  • microservices/src/payroll-service/Infrastructure/Migrations/PayrollDbContextModelSnapshot.cs
  • microservices/src/payroll-service/Backfill/MonolithSourceReader.cs
  • microservices/src/payroll-service/Backfill/PayrollBackfillRunner.cs

See Also​

Keywords​

  • Payroll database
  • Payroll Database Ownership and Boundaries
  • Payroll persistence

Revision Information​

  • Status: Draft
  • Last reviewed: 2026-07-15
  • Review cycle: Quarterly