mantisbt:db_schema
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| mantisbt:db_schema [2016/01/04 12:31] – created dregad | mantisbt: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 | ||
| * 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!!! | ||
| + | </ | ||
| //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 ==== | ||
| - | '' | + | '' |
| + | |||
| + | Example 1: Simple function without arguments | ||
| + | |||
| + | * schema.php <code php> | ||
| + | $g_upgrade[186] = array( ' | ||
| + | </ | ||
| + | * install_helper_functions_api.php <code php> | ||
| + | function install_update_history_long_custom_fields() { | ||
| + | # [... function code ...] | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Example 2: function with arguments | ||
| + | |||
| + | * schema.php (actual code was reformatted to improve readability)< | ||
| + | $g_upgrade[107] = array( ' | ||
| + | db_get_table( ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ) ); | ||
| + | </ | ||
| + | * 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 ...] | ||
| + | } | ||
| + | </ | ||
| ==== 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' | This is used to skip the step while maintaining the upgrade sequence, e.g. when an operation becomes obsolete or doesn' | ||
mantisbt/db_schema.1451928707.txt.gz · Last modified: by dregad
