Jump to content

Developer Documentation

Making database changes in a plugin


To run code such as database changes when your plugin is installed, open the /plugins/<your plugin>/dev/setup/install.php file and follow the instructions given by the doc-comments.

Note: You must add an initial version in the developer center in order for the install.php installation file to be executed.

Please don't use any official application prefixes like cms_ core_ forums_ or blog_  to name your custom database tables, use some unique names to avoid any further confusion.


Plugins support version management. Whenever you release a new version of your plugin you should add a new version in the Plugin Developer Center. When you add a version, you must specify an ID number to represent it (e.g. "10000", "10001", etc.) as well as a human-readable string (e.g. "1.0.0", "1.0.1", etc.). There is no particular standard to how the ID number should be formatted other than it must increase the newer the version. The human-readable string should be in the format "x.y.z".

For each version, a file will be added to the /plugins/<your plugin>/dev/setup folder where you can specify code that will be ran when upgrading to that version (see the doc-comments within them for more details).

It is important to note that at install, only install will be ran, so when you make a change you will usually need to add it both to your installer, and the appropriate upgrade file for that version.


To run code such as database changes when your plugin is uninstalled, create the /plugins/<your plugin>/uninstall.php file and include all required code which needs to be run to e.g. remove additional database tables and columns.

  Report Document

  • Create New...