Subversion Repositories SmartDukaan

Rev

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

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