Fix "Database Table Structure NOT Up to Date" before Update

From Joomla! Documentation

Other languages:
Deutsch • ‎English • ‎Nederlands

Errors reported[edit]

When updating Joomla! the database table structure has to be up to date before the process can start.

The "Pre-Update Check for Joomla" complains if this is not the case.

Joomla! 4 - Pre-Update Check - database table structure not up to date

But when you go to 'System - Maintenance - Database' there is no entry available.

Versions affected[edit]

General Information

This was reported in any Joomla! 4.x versions.

What is the cause[edit]

This is caused by an empty #__schemas table in the database. Most likely this occurs when the Joomla! instance is not installed by the official Joomla! installer but e.g. though an customized script which did not fill in all required data.

How to fix[edit]

You can fix this by adding the missing value to the table. First, you need the ID from Joomla!. Go to the #__extensions table via e.g. phpMyAdmin (or another database client). Search for name="files_joomla" and write down the ID (in our case 211).

Second, you need to know the latest SQL script which is installed. Go to "administrator/components/com_admin/sql/updates/mysql" and get the file name with the highest version. In this example, assume "4.0.3-2021-09-05.sql" is the filename with the highest version. Now you have to add this in your insert query as the second value:

INSERT INTO `#__schemas` (`extension_id`, `version_id`) VALUES
(211, '4.0.3-2021-09-05');

or for PostgreSQL:

INSERT INTO "#__schemas" ("extension_id", "version_id") VALUES
(211, '4.0.3-2021-09-05');

Replace "#__" by your database prefix (see Global Configuration) before running the statements.

Then go to "System - Maintenance - Database" and fix the tables.

Now the update should work as expected.