Files
sure/db/migrate
RealDiligent 98bf563458 fix: prevent AddAmountToTransfers migration aborting on legacy transfer data (#2795)
The backfill computed amount = outflow_entry.amount - source_fee_amount
and then added a check constraint requiring amount >= 0. Historical rows
that predate the modern sign convention (negative outflow amounts) or
carry fees larger than the entry amount produce a negative principal, so
the constraint aborts the migration with PG::CheckViolation — blocking
db:prepare and the entire upgrade for affected self-hosters.

Normalize with ABS and clamp at zero in the backfill. Rows that already
satisfied the old expression are unchanged (ABS is a no-op for positive
amounts); only previously-failing rows now migrate instead of killing
the upgrade.

Fixes #2653

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-26 01:54:49 +02:00
..
2024-02-02 09:05:04 -06:00
2024-02-02 09:05:04 -06:00