Subversion Repositories SmartDukaan

Rev

Rev 37704 | Blame | Compare with Previous | Last modification | View Log | RSS feed

-- Reopening a delayed internal movement PO.
--
-- POScheduler ages a purchase order off createdAt, and createdAt is the PO date - so a PO reopened after the
-- auto-close window is immediately older than the window again and the next tick closes it straight back. This
-- column records when a PO was reopened; the scheduler ages off that instead when it is set, giving a reopened PO
-- the same fresh window a new one gets.
--
-- Additive and nullable: existing rows keep behaving exactly as before, and code that does not know the column
-- ignores it - so this runs safely BEFORE the release that maps it, and must, because the entity maps it.
--
-- hadb1 is MySQL 5.7, which has no INSTANT add-column, so this rebuilds the table rather than only touching
-- metadata. ~53k rows, seconds. ALGORITHM/LOCK are stated so it fails loudly rather than quietly taking a
-- table lock if that ever stops being true.
ALTER TABLE warehouse.purchaseorder
    ADD COLUMN reopenedAt DATETIME NULL COMMENT 'When this PO was last reopened; POScheduler ages from this when set',
    ALGORITHM=INPLACE, LOCK=NONE;