Attendance Migrations and Seeding
Summary
The current Attendance model has three code-first migrations plus a model snapshot. Runtime startup applies pending migrations unless an explicit operational suppression setting is enabled.
Audience
- Backend developers, DevOps engineers, QA engineers, and architects
Reference Content
Migration inventory
| Sequence | Purpose |
|---|---|
| Initial Attendance schema | Creates schema plus Attendance, punch, reopen, employee projection, payroll snapshot, audit, and outbox objects and indexes |
| Shift/weekly-off/policy foundation | Adds Time Office objects, timeline, policy-rule foreign key, and related indexes |
| Assignment user compatibility | Adds the optional compatibility user reference to Shift assignments |
The snapshot represents the current EF model and must agree with migration output. Development mode invokes an idempotent seeder for foundation Time Office data after migration. Seeder values are implementation fixtures, not product defaults, and are intentionally not reproduced here.
Migration suppression is confirmed conceptually, but the configuration key is omitted for public safety. Backfill assumes the required target schema already exists; it is not a replacement for migration application.
Rollback methods exist in migrations, but reversibility of populated production data is Requires confirmation. Review generated SQL, locks, data conversion, backward compatibility, tenant behavior, and rollback evidence in an isolated environment. This guide does not authorize production commands or destructive SQL.
Source References
microservices/src/attendance-service/Infrastructure/Migrations/20260702135737_InitialAttendanceSchema.csmicroservices/src/attendance-service/Infrastructure/Migrations/20260709123504_AddShiftWeeklyOffPolicyFoundation.csmicroservices/src/attendance-service/Infrastructure/Migrations/20260709143830_AddEmployeeShiftAssignmentUserId.csmicroservices/src/attendance-service/Infrastructure/Migrations/AttendanceDbContextModelSnapshot.csmicroservices/src/attendance-service/Infrastructure/DevelopmentSeeder.csmicroservices/src/attendance-service/Program.cs
Related Articles
See Also
Keywords
- Attendance persistence
- EF Core
- PostgreSQL
Revision Information
- Status: Draft
- Last reviewed: 2026-07-15
- Review cycle: Quarterly