civicrm/civicrm-core — pull request #462 by pratik-joshi (2013-04-17 13:39:52+00:00)
Title: CRM-12367 : http://forum.civicrm.org/index.php/topic,28397.msg121403.html#msg121403

The issue :

When a upgrade is done from 4.2.9 to 4.3.x, at 4.3.alpha1 (line no: 58) a new column adding named premiums_nothankyou_label is been done inside civicrm_premiums table. This is handled only for multi-lingual, so to handle the missed out simple upgrade handling (of adding this column), the code was done in CRM_Upgrade_Incremental_php_FourThree::upgrade_4_3_beta5 line no. 287.

- During the simple upgrade from 4.2.9 to 4.3.x this works properly and the DB is correctly upgraded.

- The process happens during multi-lingual upgrade : the intended column is created in 4.3.alpha1 upgrade script, and later on also excutes 'CRM_Upgrade_Incremental_php_FourThree::upgrade_4_3_beta5 (line no. 287)' query. Which executes CRM_Core_DAO::executeQuery with 6 paramter i.e $i18nRewrite = TRUE, which translates 'civicrm_premiums' table in query to a lingual table (civicrm_premiums_en_US) and excutes the query - but since 'civicrm_premiums_en_US' is a VIEW a DB ERROR is thrown.

The fix :

What we should do is to execute 'CRM_Upgrade_Incremental_php_FourThree::upgrade_4_3_beta5 (line no. 287)' query only for simple upgrade as we are already executing the handling for column creation in 4.3.alpha1 for multi-lingual upgrade.

Also introduced CRM/Core/I18n/SchemaStructure_4_3_1.php this file, as after upgrade : the VIEWS (multi-lingual tables) whose base table is civicrm_premiums didn't consist of column 'premiums_nothankyou_label', after this introduction the triggerRebuild takes up this file and creates a correct VIEW.