mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
Guards the two facts the report exists to get right: the cancellation fee is never a payable, and exactly one wagon-cancellation status (CREDIT_AVAILABLE) is a live liability. Adding a status to WAGON_CANCELLATION_STATUSES now fails here until someone decides which side of the ledger it lands on. Also pins the sort expressions to the union wrapper alias — a branch alias would resolve at build time and 42P01 at runtime, since the runner appends ORDER BY outside the subquery.