Manual:SQL patch file

You might write an SQL file either for a schema change in the core (see policy>Special:MyLanguage/Development_policy/Until_2018#Database_policy|Development_policy#Database_patches, ) or for an extension (see ).

See also the.

Example
An SQL file to create a table might look something like this:

Variable replacement
The first two need to be used in patch files, as in the example above.


 *   will be replaced with .
 *   will be replaced with an index prefix.
 * Note:  is not needed if your code doesn't need to be compatible with MW versions of < 1.35.
 *   will be replaced with the value of .
 *  </> is only used for <tvar|2></> database backends.

There are other variable replacements but they are not used in practice.

See the documentation of <tvar|replaceVars>Database::replaceVars</> for the full list.