Commit 3e277b59 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Upgrade automatically 'message_queue' table to add 'group_method_id'.

This is meaningful when starting an old ERP5 instance using recent code,
otherwise it fails during automatic migration to ZODB Property Sheets as
Activities cannot be processed for example.
parent ca565876
......@@ -577,6 +577,22 @@ class ActivityTool (Folder, UniqueObject):
for activity in activity_dict.itervalues():
activity.initialize(self)
self.maybeMigrateConnectionClass()
connection = self.cmf_activity_sql_connection()
for column_dict in connection.columns('message_queue'):
if column_dict['Name'] == 'group_method_id':
break
else:
LOG('ActivityTool', INFO,
"Upgrading 'message_queue' table to add 'group_method_id' column")
connection.query(
'ALTER TABLE message_queue ADD COLUMN `group_method_id` '
'VARCHAR(255) NOT NULL DEFAULT \'\' AFTER `priority`')
import transaction
transaction.commit()
is_initialized = True
security.declareProtected(Permissions.manage_properties, 'isSubscribed')
......
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