Manual:SQL patch file

You might write an SQL file either for a schema change in the core (see 1>Special:MyLanguage/Development_policy/Until_2018#Database_policy|Development_policy#Database_patches, ) or for an extension (see ). See also the 1>Special:MyLanguage/Manual:Coding conventions/Database|general database coding conventions.

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 .
 *   is used to identify indexes so their name can be changed via the index alias system. (This was only ever used for a small number of core tables and has been removed in MediaWiki 1.35, so in practice this does not make any difference.)
 *   will be replaced with the value of .
 * <tvar|1> </> 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|1></> for the full list.