User Tools

  • Logged in as: anonymous (anonymous)
  • Log Out

Site Tools


mantisbt:db_schema

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
mantisbt:db_schema [2016/01/04 12:31] – created dregadmantisbt:db_schema [2016/01/04 12:53] (current) – [Introduction] added wrap dregad
Line 10: Line 10:
   - An array of **parameters** to be passed to the function.   - An array of **parameters** to be passed to the function.
  
-**The integrity of the schema relies on strict ordering of this array.**+<WRAP important round> 
 +**The schema's integrity relies on strict ordering of this array.**
  
   * ONLY ADD NEW CHANGES TO THE END OF THE TABLE!!!\\ Always specify the schema step (array key), for documentation purposes   * ONLY ADD NEW CHANGES TO THE END OF THE TABLE!!!\\ Always specify the schema step (array key), for documentation purposes
   * NEVER SKIP AN INDEX IN THE SEQUENCE!!!   * NEVER SKIP AN INDEX IN THE SEQUENCE!!!
 +</WRAP>
  
 //Release markers// are placed right AFTER the last schema step that is included in the corresponding release: //Release markers// are placed right AFTER the last schema step that is included in the corresponding release:
Line 56: Line 58:
 ==== UpdateFunction ==== ==== UpdateFunction ====
  
-''UpdateFunction'' allows arbitrary PHP code to be executed via a function, which must be defined in //install_helper_functions_api.php// with ''install_'' prefix.+''UpdateFunction'' allows arbitrary PHP code to be executed via a function, which must be defined in //install_helper_functions_api.php// with an ''install_'' prefix. 
 + 
 +Example 1: Simple function without arguments 
 + 
 +  * schema.php <code php> 
 +$g_upgrade[186] = array( 'UpdateFunction', 'update_history_long_custom_fields' ); 
 +</code> 
 +  * install_helper_functions_api.php <code php> 
 +function install_update_history_long_custom_fields() { 
 + # [... function code ...] 
 +
 +</code> 
 + 
 +Example 2: function with arguments 
 + 
 +  * schema.php (actual code was reformatted to improve readability)<code php> 
 +$g_upgrade[107] = array( 'UpdateFunction', 'date_migrate', array( 
 + db_get_table( 'bug_file' ), 
 + 'id', 
 + 'date_added', 
 + 'date_added_int' 
 +) ); 
 +</code> 
 +  * install_helper_functions_api.php <code php> 
 +/** 
 + * Migrate the legacy date format. 
 + * @param array $p_data Array: [0] = tablename, [1] id column, [2] = old column, [3] = new column. 
 + * @return integer 
 + */ 
 +function install_date_migrate( array $p_data ) { 
 + # [... function code ...] 
 +
 +</code>
  
 ==== null ==== ==== null ====
  
-No-op upgrade step.+No-op upgrade step. The installer will do nothing.
  
 This is used to skip the step while maintaining the upgrade sequence, e.g. when an operation becomes obsolete or doesn't apply for specific cases. This is used to skip the step while maintaining the upgrade sequence, e.g. when an operation becomes obsolete or doesn't apply for specific cases.
  
mantisbt/db_schema.1451928707.txt.gz · Last modified: 2016/01/04 12:31 by dregad

Driven by DokuWiki