Payroll Database Overview
Summary
The verified Payroll persistence model, its boundaries, and its implementation status.
Audience
Payroll developers, QA and support engineers, solution and security architects, and implementation partners.
Overview
This page summarizes the verified Payroll persistence foundation and links its detailed evidence.
Purpose
Provide a public-safe map of Payroll-owned persistence without publishing physical schemas or SQL.
Ownership
Payroll Service owns one EF Core context, PayrollDbContext, with 19 persisted object sets. Eighteen types are Payroll domain entities; the outbox record is supplied by the shared kernel. The current model contains no EF-owned types or persisted value objects.
Lifecycle
Runtime commands and inbound projections update the context. Migrations evolve the model, development-only seeding supplies local verification data, and the backfill path can populate transitional read models from the monolith.
Persisted fields
The model stores identifiers, tenant ownership, period and lifecycle state, employee references, calculation outcomes, fixed-precision monetary and unit values, timestamps, projection version markers, and bounded structured payloads. Sensitive employee and payment data is intentionally not enumerated here.
Relationships
Objects carry logical reference identifiers between periods, runs, details, employees, reversals, payslips, audit/timeline records, and projections. No EF foreign keys or navigation relationships are configured; referential enforcement is therefore an application responsibility.
Constraints
Every object has a primary key. Ten unique indexes enforce selected tenant-scoped business identities and outbox event identity. Required strings, bounded lengths, fixed-precision numeric mappings, and structured-document mappings are configured selectively.
Indexes
The current model contains 23 explicit secondary indexes: 10 unique and 13 non-unique. There are no confirmed foreign-key indexes because no foreign keys are configured.
Tenant behavior
Seventeen tenant-owned object types have a global tenant query filter with a privileged-context path. Processed integration events and outbox records contain tenant metadata but have no global filter. Many implementation queries deliberately disable filters and supply an explicit tenant predicate.
Audit behavior
Payroll audit logs, employee/run timeline entries, processed-event markers, and outbox records provide distinct evidence. Coverage is operation-specific and must not be interpreted as database-wide change auditing.
Integration usage
Inbound events maintain local projections and processed-event markers. Outbox records capture outbound publication intent in selected local commits. Broker acknowledgement and external document/notification work remain outside the EF commit.
Known limitations
The persistence model is Transitional: native, compatibility, projection, and backfill paths coexist. No database-enforced relationships, optimistic concurrency token, or complete tenant-isolation proof is confirmed.
Requires confirmation
- Production migration governance and rollback approval.
- Automatic outbox relay execution in the deployed Payroll host.
- Database-level isolation controls beyond the EF model.
- Retention and archival policy for payroll evidence.
Source References
microservices/src/payroll-service/Infrastructure/PayrollDbContext.csmicroservices/src/payroll-service/Domain/PayrollEntities.csmicroservices/src/payroll-service/Infrastructure/Migrations/PayrollDbContextModelSnapshot.csmicroservices/src/payroll-service/Program.csmicroservices/src/payroll-service/Application/PayrollCalculationService.csmicroservices/src/payroll-service/Messaging/PayrollReadModelConsumer.cs
Related Articles
See Also
Keywords
- Payroll database
- Payroll Database Overview
- Payroll persistence
Revision Information
- Status: Draft
- Last reviewed: 2026-07-15
- Review cycle: Quarterly