Joomla's keeps track of schema versions for itself and components in the #__schemas
table. It lists the extension_id
and with the version_id
and uses that to determine what updates to run. For example you will see entries similar to this:
700 3.3.6-2014-09-30
709 1.2.0
As you might guess from the lines above 700 is the id
of an extension called files_joomla
i.e. Joomla.
You can read more about it in the Joomla Doc's article "Managing Component Updates (Update SQL files)" (which states 2.5 but I don't think it's changed since then).
Most people miss this note in the article:
Important Note: These files are also used to set the version number in the #__schemas table. This version number must be present in the current version of the component in order for the new SQL files to be run during the update. For example, if you have version 1.0 and are updating to version 1.1, the 1.1.sql file will not be executed if there was no 1.0.sql file in the 1.0 release. For this reason, it is good practice to have a SQL update file for each version, even if there is no SQL change in that version. You can just use an empty file or a file with a comment line.