Workflow Indexes and Constraints
Audience
Backend engineers, database engineers, QA and architects.
Summary
The model defines primary keys for all 11 entities, three explicit unique business/event constraints and indexes for ownership, worklists, lifecycle and chronological reads.
Reference Content
| Entity | Verified indexes/constraints |
|---|---|
| Definition | Primary key; unique tenant/key |
| Version | Primary key; unique definition/version number |
| Step | Primary key; version/order index |
| Condition | Primary key; version foreign-key index |
| Instance | Primary key; tenant/status; tenant/key |
| Task | Primary key; instance foreign-key index; tenant/status/user; tenant/status/role |
| Action | Primary key; instance index |
| Audit | Primary key; tenant/occurrence |
| Timeline | Primary key; tenant/occurrence |
| Outbox | Primary key; unique event identifier; status/occurrence |
| Processed event | Primary key; unique event identifier |
Constraint boundaries
Required fields, maximum text lengths and cascade foreign keys are enforced by the migration. No check constraints, filtered indexes or concurrency constraints were found.
Requires Confirmation
Index effectiveness under production volume, additional subject/definition lookups and check constraints require confirmation.
Source References
microservices/src/workflow-service/Infrastructure/WorkflowDbContext.csmicroservices/src/workflow-service/Infrastructure/Migrations/20260706165438_InitialWorkflowSchema.csmicroservices/src/workflow-service/Infrastructure/Migrations/WorkflowDbContextModelSnapshot.cs
Related Articles
See Also
Keywords
Workflow database, EF Core, Workflow schema.
Revision Information
- Status: Draft
- Last reviewed: 2026-07-20
- Next review: 2026-10-20