Commit f00b5c58 authored by Mame Coumba Sall's avatar Mame Coumba Sall

Add new column "order_id" and make it part of the primary key. This column...

Add new column "order_id" and make it part of the primary key. This column will avoid conflicts like Exception: _mysql_exceptions.IntegrityError (1062, "Duplicate entry '65398-24823' for key 1")

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31652 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2058f8cb
......@@ -175,10 +175,12 @@ WHERE\n
\n
<dtml-var "\'\\0\'">\n
\n
<dtml-let movement_list="[]">\n
<dtml-let movement_list="[]" uid_dict="{}">\n
<dtml-in prefix="loop" expr="_.range(_.len(uid))">\n
<dtml-if "isMovement[loop_item] and isAccountable[loop_item] and getAggregateUidList[loop_item]">\n
<dtml-call expr="uid_dict.update({uid[loop_item]: uid_dict.get(uid[loop_item], -1) + 1})">\n
<dtml-call expr="movement_list.append(loop_item)">\n
\n
</dtml-if>\n
</dtml-in>\n
<dtml-if expr="_.len(movement_list) > 0">\n
......@@ -187,8 +189,11 @@ INSERT INTO\n
VALUES\n
<dtml-in prefix="loop" expr="movement_list">\n
<dtml-in "getAggregateUidList[loop_item]">\n
( \n
\n
( \n
<dtml-call expr="uid_dict.update({uid[loop_item]: uid_dict.get(uid[loop_item], -1) + 1})">\n
<dtml-sqlvar expr="uid[loop_item]" type="int">,\n
<dtml-sqlvar expr="uid_dict[uid[loop_item]]" type="int">,\n
<dtml-sqlvar expr="getStopDate[loop_item]" type="datetime" optional>,\n
<dtml-sqlvar expr="getDestinationUid[loop_item]" type="int" optional>,\n
<dtml-sqlvar expr="getDestinationSectionUid[loop_item]" type="int" optional>,\n
......@@ -254,10 +259,12 @@ WHERE\n
\n
<dtml-var "\'\\0\'">\n
\n
<dtml-let movement_list="[]">\n
<dtml-let movement_list="[]" uid_dict="{}">\n
<dtml-in prefix="loop" expr="_.range(_.len(uid))">\n
<dtml-if "isMovement[loop_item] and isAccountable[loop_item] and getAggregateUidList[loop_item]">\n
<dtml-call expr="uid_dict.update({uid[loop_item]: uid_dict.get(uid[loop_item], -1) + 1})">\n
<dtml-call expr="movement_list.append(loop_item)">\n
\n
</dtml-if>\n
</dtml-in>\n
<dtml-if expr="_.len(movement_list) > 0">\n
......@@ -266,8 +273,11 @@ INSERT INTO\n
VALUES\n
<dtml-in prefix="loop" expr="movement_list">\n
<dtml-in "getAggregateUidList[loop_item]">\n
( \n
\n
( \n
<dtml-call expr="uid_dict.update({uid[loop_item]: uid_dict.get(uid[loop_item], -1) + 1})">\n
<dtml-sqlvar expr="uid[loop_item]" type="int">,\n
<dtml-sqlvar expr="uid_dict[uid[loop_item]]" type="int">,\n
<dtml-sqlvar expr="getStopDate[loop_item]" type="datetime" optional>,\n
<dtml-sqlvar expr="getDestinationUid[loop_item]" type="int" optional>,\n
<dtml-sqlvar expr="getDestinationSectionUid[loop_item]" type="int" optional>,\n
......
......@@ -88,6 +88,7 @@
#\n
CREATE TABLE `item` (\n
`uid` BIGINT UNSIGNED NOT NULL,\n
`order_id` TINYINT UNSIGNED NOT NULL,\n
`date` datetime,\n
`node_uid` BIGINT UNSIGNED default \'0\',\n
`section_uid` BIGINT UNSIGNED default \'0\',\n
......@@ -95,7 +96,7 @@ CREATE TABLE `item` (\n
`aggregate_uid` BIGINT UNSIGNED default \'0\',\n
`variation_text` VARCHAR(255),\n
`simulation_state` VARCHAR(255) default \'\',\n
PRIMARY KEY (`uid`, `aggregate_uid`),\n
PRIMARY KEY (`uid`, `aggregate_uid`,`order_id`),\n
KEY `section_uid` (`section_uid`),\n
KEY `resource_uid` (`resource_uid`),\n
KEY `variation_text` (`variation_text`),\n
......@@ -144,6 +145,7 @@ CREATE TABLE `item` (\n
#\n
CREATE TABLE `item` (\n
`uid` BIGINT UNSIGNED NOT NULL,\n
`order_id` TINYINT UNSIGNED NOT NULL,\n
`date` datetime,\n
`node_uid` BIGINT UNSIGNED default \'0\',\n
`section_uid` BIGINT UNSIGNED default \'0\',\n
......@@ -151,7 +153,7 @@ CREATE TABLE `item` (\n
`aggregate_uid` BIGINT UNSIGNED default \'0\',\n
`variation_text` VARCHAR(255),\n
`simulation_state` VARCHAR(255) default \'\',\n
PRIMARY KEY (`uid`, `aggregate_uid`),\n
PRIMARY KEY (`uid`, `aggregate_uid`,`order_id`),\n
KEY `section_uid` (`section_uid`),\n
KEY `resource_uid` (`resource_uid`),\n
KEY `variation_text` (`variation_text`),\n
......
165
\ No newline at end of file
166
\ No newline at end of file
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