KamoCRM

The partial indexes that stop a double payment and a code collision

FeatureInitializerService
Shipped
12 ஆகஸ்ட், 2026 அன்று 7:10 AM UTC
Author
Kamo
Commit
a9ab215

**************** is the teeth behind the export service's refusal to re-issue. A second committed file for one pay period double-pays an entire company, and the service-layer check alone loses to two operators clicking at the same moment. A correction carries reverses_batch_id and is therefore excluded from the predicate, which is the whole reason this cannot be a plain unique constraint on the entity — and the test asserts that exclusion, because without it a correction could never be issued at all. ux_tclabor_code_active scopes labor-account code uniqueness to the ACTIVE rows. A retired department re-created under its old code is ordinary accounting housekeeping; a blanket constraint would force the org to invent "SALES-2" while the retired row still has to exist for historical segments to point at. The entity's blanket constraint was dropped in favour of this. EXPORT_REVOKE revokes DELETE but deliberately NOT UPDATE: a batch legitimately transitions DRY_RUN -> COMMITTED -> REVERSED, and revoking UPDATE would freeze a dry run before it could ever be committed. The test pins that distinction.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing