Commit 5da1eb5e authored by Arnaud Fontaine's avatar Arnaud Fontaine

Prevent order_id column value to overflow following changes in Inventory (cf53db45).

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.
parent 580a4224
......@@ -58,7 +58,7 @@
#\n
CREATE TABLE `stock` (\n
`uid` BIGINT UNSIGNED NOT NULL,\n
`order_id` TINYINT UNSIGNED NOT NULL,\n
`order_id` BIGINT UNSIGNED NOT NULL,\n
`explanation_uid` BIGINT UNSIGNED,\n
`node_uid` BIGINT UNSIGNED,\n
`section_uid` BIGINT UNSIGNED,\n
......
2013-05-08 arnaud.fontaine
* Prevent order_id column value to overflow following changes in Inventory (cf53db4).
2011-04-14 yusei
* Add datetime key to effective_date and expiration_date on versioning table. They were missing.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment