Forum OpenACS Development: how to create upgrade script for a service contract?

Hi all,

The payment-gateway needs to have another element added to most of it's service contract "message types".

Can I just update acs_sc_msg_type_elements using sql similar to below, or is there a standardized approach for doing this?

update acs_sc_msg_type_elements set element_pos = element_pos + 1 
where element_pos > '6' and 
      msg_type_id in ( select msg_type_id,element_name,element_pos from acs_sc_msg_type_elements where msg_type_id in ( 
           select msg_type_id from acs_sc_msg_types where msg_type_name in (
     'PaymentGateway.Authorize.InputType', 'PaymentGateway.ChargeCard.InputType', 'PaymentGateway.Return.InputType', 'PaymentGateway.Void.InputType' ) ) );

insert into acs_sc_msg_type_elements 
    (msg_type_id, element_name, element_pos) 
    values (select msg_type_id from acs_sc_msg_types where msg_type_name = 'PaymentGateway.Authorize.InputType'),'card_code','7');

insert into acs_sc_msg_type_elements 
    (msg_type_id, element_name, element_pos) 
    values (select msg_type_id from acs_sc_msg_types where msg_type_name = 'PaymentGateway.ChargeCard.InputType'),'card_code','7');

insert into acs_sc_msg_type_elements 
    (msg_type_id, element_name, element_pos) 
    values (select msg_type_id from acs_sc_msg_types where msg_type_name = 'PaymentGateway.Return.InputType'),'card_code','7');

insert into acs_sc_msg_type_elements 
    (msg_type_id, element_name, element_pos) 
    values (select msg_type_id from acs_sc_msg_types where msg_type_name = 'PaymentGateway.Void.InputType'),'card_code','7');
btw this problem is all that is holding up release of ecommerce and related packages for use on versions oacs-5-2 through head and the latest release.
Once I corrected the sql, tests show it will not work.

It seems one has to re-install payment-gateway (disable, uninstall, install, then go to acs-service-contracts to install bindings) in order to upgrade payment-gateway. I'll make a note in the .info file.