Skip to main content

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

SequencePurpose
Initial Attendance schemaCreates schema plus Attendance, punch, reopen, employee projection, payroll snapshot, audit, and outbox objects and indexes
Shift/weekly-off/policy foundationAdds Time Office objects, timeline, policy-rule foreign key, and related indexes
Assignment user compatibilityAdds 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.cs
  • microservices/src/attendance-service/Infrastructure/Migrations/20260709123504_AddShiftWeeklyOffPolicyFoundation.cs
  • microservices/src/attendance-service/Infrastructure/Migrations/20260709143830_AddEmployeeShiftAssignmentUserId.cs
  • microservices/src/attendance-service/Infrastructure/Migrations/AttendanceDbContextModelSnapshot.cs
  • microservices/src/attendance-service/Infrastructure/DevelopmentSeeder.cs
  • microservices/src/attendance-service/Program.cs

See Also

Keywords

  • Attendance persistence
  • EF Core
  • PostgreSQL

Revision Information

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