Commit cb576b62 authored by Alain Takoudjou's avatar Alain Takoudjou

fix column order and index table stock. Some portal_type will need to be reindexed

parent 40921010
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
\n
# Reindex all objects in accounting module\n
folder_tag = \'reindex_module\'\n
object_tag = \'accounting\'\n
portal.accounting_module.activate(tag=folder_tag).Folder_reindexAll(\n
folder_tag=folder_tag,\n
object_tag=object_tag)\n
\n
priority = 4\n
folder_after_tag = object_tag\n
object_tag = \'sale_packing_list\'\n
object_after_tag = folder_after_tag\n
# Reindex all objects in Sale Packing List module\n
portal.sale_packing_list_module.activate(tag=folder_tag,\n
priority=priority,\n
after_tag=folder_after_tag\n
).Folder_reindexAll(\n
folder_tag=folder_tag,\n
object_tag=object_tag,\n
object_priority=priority,\n
folder_after_tag=folder_after_tag,\n
object_after_tag=object_after_tag)\n
\n
# Reindex all objects in Portal Simulation\n
folder_after_tag = (\'accounting\', \'sale_packing_list\')\n
object_tag = \'simulation\'\n
object_after_tag = folder_after_tag\n
portal.portal_simulation.activate(tag=folder_tag,\n
priority=priority,\n
after_tag=folder_after_tag\n
).Folder_reindexAll(\n
folder_tag=folder_tag,\n
object_tag=object_tag,\n
object_priority=priority,\n
folder_after_tag=folder_after_tag,\n
object_after_tag=object_after_tag)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_postUpgradeReindexObjects</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -77,15 +77,24 @@ END IF;\n ...@@ -77,15 +77,24 @@ END IF;\n
-- add a column funding_uid safely\n -- add a column funding_uid safely\n
IF NOT EXISTS( (SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE()\n IF NOT EXISTS( (SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE()\n
AND COLUMN_NAME=\'funding_uid\' AND TABLE_NAME=\'stock\') ) THEN\n AND COLUMN_NAME=\'funding_uid\' AND TABLE_NAME=\'stock\') ) THEN\n
ALTER TABLE `stock` ADD COLUMN `funding_uid` BIGINT UNSIGNED AFTER `order_id`;\n ALTER TABLE `stock` ADD COLUMN `funding_uid` BIGINT UNSIGNED AFTER `project_uid`;\n
END IF;\n END IF;\n
\n \n
-- add a column payment_request_uid safely\n -- add a column payment_request_uid safely\n
IF NOT EXISTS( (SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE()\n IF NOT EXISTS( (SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE()\n
AND COLUMN_NAME=\'payment_request_uid\' AND TABLE_NAME=\'stock\') ) THEN\n AND COLUMN_NAME=\'payment_request_uid\' AND TABLE_NAME=\'stock\') ) THEN\n
ALTER TABLE `stock` ADD COLUMN `payment_request_uid` BIGINT UNSIGNED AFTER `order_id`;\n ALTER TABLE `stock` ADD COLUMN `payment_request_uid` BIGINT UNSIGNED AFTER `funding_uid`;\n
END IF;\n END IF;\n
\n \n
-- Modify column order_id\n
ALTER TABLE `stock` MODIFY `order_id` BIGINT UNSIGNED;\n
\n
-- Upgrade Index\n
ALTER TABLE `stock` DROP INDEX `section_uid`, ADD INDEX `section_uid_portal_type_mirror_section_uid` (`section_uid`,`portal_type`, `mirror_section_uid`);\n
ALTER TABLE `stock` ADD INDEX `funding_uid` (`funding_uid`);\n
ALTER TABLE `stock` ADD INDEX `explanation_uid` (`explanation_uid`);\n
ALTER TABLE `stock` DROP INDEX `resource_uid`;\n
\n
END//\n END//\n
\n \n
DELIMITER ;\n DELIMITER ;\n
......
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