• Arnaud Fontaine's avatar
    Prevent order_id column value to overflow following changes in Inventory (cf53db45). · 5da1eb5e
    Arnaud Fontaine authored
    To apply this change on existing on existing table:
    ALTER TABLE stock MODIFY order_id BIGINT UNSIGNED
    
    Before, when creating new full inventory Document, resources which are not
    present in new Inventory Document were simply ignored. So, new movements were
    added "manually" with quantity less than or equal to 0 to workaround this
    issue.
    
    New inventory fixes this issue so that this workaround is not needed
    anymore. Temporary movements are created for resources not present in new
    Inventory Document and added to stock table (through z_catalog_stock_list Z
    SQL Method) with uid equals to Inventory Document UID.  However, the primary
    key on stock table is (uid BIGINT UNSIGNED, order_id TINYINT UNSIGNED), thus
    when there are strictly more than 255 temporary movements, order_id overflows
    because the max value of TINYINT UNSIGNED is 255 and MySQL sets order_id to
    255 after the first 255 temporary movements (as strict SQL mode is not
    enabled), thus raising an IntegrityError later on because of duplicated
    entries.
    5da1eb5e
change_log 3 KB