Files
threadcount-community/prisma/migrations/20260911000000_stamp_outstanding_activate_codes/migration.sql
T
ThreadCount 46a1911c1c ThreadCount Community edition
Uniform stock management for healthcare linen rooms: the coordinator app, the phone counter and the staff app, for your own server. Built from 5470a36 on 2026-09-13. Licensed under the Functional Source License (FSL-1.1-ALv2).
2026-09-13 11:35:40 +10:00

17 lines
984 B
SQL

-- Give the slips already in people's hands a printing date.
--
-- Staff.activateCodeAt was added for an expiry rule that was then never wired up: nothing wrote the
-- column and nothing read it. Now that the activation route refuses a slip printed more than
-- fourteen days ago, a row holding a code with no date reads as printed at the epoch, so every slip
-- outstanding on the day of the deploy would be refused as expired -- telling a nurse to go and ask
-- for a new one for a slip she was handed yesterday.
--
-- Stamping them now starts their fortnight from this deploy rather than from whenever they were
-- really printed. That is deliberately generous: these codes were valid a moment ago, and the only
-- alternative is silently killing every one of them. Rows whose code has already been spent or
-- cancelled carry a null activateCode and are left alone.
UPDATE "Staff"
SET "activateCodeAt" = now()
WHERE "activateCode" IS NOT NULL
AND "activateCodeAt" IS NULL;