Manual:Hooks/LoadExtensionSchemaUpdates

Usage
If your extension requires changes to the database when MediaWiki is updated, do it with this hook. Users can then update their wiki by running update.php

To add a new table
To add a new table, in the main file for your extension: The  file should contain the necessary   table definition.

To add a table and/or modify a field
If your extension has already added a table, but you need to modify a field in it for a new version, make the change in the sql file for the table (for people installing the extension after the change), then make a "patch" sql file to modify the field in the table (for people updating from an older version).

The  file should contain the necessary   statement to update old versions of the schema.

To add a new table
To add a new table, in the main file for your extension: The  file should contain the necessary   table definition.

To add a table and/or modify a field
If your extension has already added a table, but you need to modify a field in it for a new version, make the change in the sql file for the table (for people installing the extension after the change), then make a "patch" sql file to modify the field in the table (for people updating from an older version).

The  file should contain the necessary   statement to update old versions of the schema.

<= 1.16 and >= 1.17 dual support
It is possible to provide support for both older versions of MediaWiki, and the current versions without much extra effort required

To add a new table
To add a new table, in the main file for your extension: The  file should contain the necessary   table definition. For an example, see the FlaggedRevs extension.

To add a table and/or modify a field
If your extension has already added a table, but you need to modify a field in it for a new version, make the change in the sql file for the table (for people installing the extension after the change), then make a "patch" sql file to modify the field in the table (for people updating from an older version).

The  file should contain the necessary   statement to update old versions of the schema.