Commit 8921803e authored by Tristan Cavelier's avatar Tristan Cavelier

Update erp5_upgrader business template

- Rename some upgrader scripts
- Add upgrader script to check for table existence
- Rename some upgrade constraints
- Add upgrade constraint (table existence)
- Clean up some files
parent ae15a055
<property_sheet_list>
<portal_type id="Template Tool">
<item>TemplateToolUpgraderConstraint</item>
<item>TemplateToolBusinessTemplateInstallationConstraint</item>
<item>TemplateToolTableExistenceConstraint</item>
<item>TemplateToolWorkflowChainConsistencyConstraint</item>
</portal_type>
</property_sheet_list>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Property Sheet" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TemplateToolBusinessTemplateInstallationConstraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Sheet</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
......@@ -34,7 +34,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>business_template_installed_constraint</string> </value>
<value> <string>business_template_installation_constraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......@@ -42,7 +42,7 @@
</item>
<item>
<key> <string>script_id</string> </key>
<value> <string>TemplateTool_checkUpgradeConsistency</string> </value>
<value> <string>TemplateTool_checkBusinessTemplateInstallation</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -32,7 +32,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TemplateToolPostUpgradeConstraint</string> </value>
<value> <string>TemplateToolTableExistenceConstraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......
......@@ -34,7 +34,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>workflow_chain_constraint</string> </value>
<value> <string>table_existence_constraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......@@ -42,7 +42,7 @@
</item>
<item>
<key> <string>script_id</string> </key>
<value> <string>TemplateTool_checkPostUpgradeWorkflowChainConsistency</string> </value>
<value> <string>TemplateTool_checkTableExistence</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -32,7 +32,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TemplateToolUpgraderConstraint</string> </value>
<value> <string>TemplateToolWorkflowChainConsistencyConstraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Script Constraint" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>constraint_type/post_upgrade</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>workflow_chain_consistency_constraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Script Constraint</string> </value>
</item>
<item>
<key> <string>script_id</string> </key>
<value> <string>TemplateTool_checkWorkflowChainConsistency</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -64,7 +64,7 @@ return template_tool.upgradeSite(bt5_list,\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TemplateTool_checkUpgradeConsistency</string> </value>
<value> <string>TemplateTool_checkBusinessTemplateInstallation</string> </value>
</item>
</dictionary>
</pickle>
......
<?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>"""\n
Check for some table existence according to the create table list.\n
If `fixit` is True, then it uses the associated sql_method to create it.\n
"""\n
create_table_list = [\n
# ("category", "z_create_category"), # example\n
("catalog_full_text", "z_create_catalog_fulltext"),\n
]\n
sql_catalog = context.portal_catalog.getSQLCatalog()\n
table_list = [r[0] for r in sql_catalog.z_show_tables(table="not needed so far")]\n
report_list = []\n
for create_table_information in create_table_list:\n
if not callable(getattr(sql_catalog, create_table_information[1], None)):\n
continue\n
if create_table_information[0] not in table_list:\n
if fixit:\n
getattr(sql_catalog, create_table_information[1], None)()\n
else:\n
report_list.append("Table `%s` not created (%s)" % create_table_information)\n
return report_list\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>fixit=False</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TemplateTool_checkTableExistence</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -119,7 +119,7 @@ return error_list\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TemplateTool_checkPostUpgradeWorkflowChainConsistency</string> </value>
<value> <string>TemplateTool_checkWorkflowChainConsistency</string> </value>
</item>
</dictionary>
</pickle>
......
Template Tool | TemplateToolPostUpgradeConstraint
Template Tool | TemplateToolUpgraderConstraint
\ No newline at end of file
Template Tool | TemplateToolBusinessTemplateInstallationConstraint
Template Tool | TemplateToolTableExistenceConstraint
Template Tool | TemplateToolWorkflowChainConsistencyConstraint
\ No newline at end of file
TemplateToolUpgraderConstraint
TemplateToolPostUpgradeConstraint
\ No newline at end of file
TemplateToolBusinessTemplateInstallationConstraint
TemplateToolWorkflowChainConsistencyConstraint
TemplateToolTableExistenceConstraint
\ No newline at end of file
erp5_full_text_mroonga_catalog
erp5_full_text_myisam_catalog
erp5_base
erp5_upgrader_test
\ 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