I have a Joomla component and Joomla 4 reports that it has database problems, however I am pretty sure that it does not.
Scenario: component A has 02 SQL update files named 1.0.0.sql and 1.1.0.sql
File 1.0.0.sql contains this SQL statement:
ALTER TABLE X CHANGE column_a
column_a
VARCHAR(10) NOT NULL;
File 1.1.0.sql contains this SQL statement:
ALTER TABLE X CHANGE column_a
column_a
VARCHAR(100) NOT NULL;
When checking for dabase problems, Joomla run through all SQL update files, and then immediately reports a problem in file 1.0.0.sql, as it does not match the actual column in the database. But there should be no problems at all in this scenario, as 1.1.0.sql is the latest one, and it should be checked agains the database, not all past update SQL files, am I wrong?
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-12-11 15:41:09 |
Closed_By | ⇒ | sousa9g | |
Labels |
Added:
No Code Attached Yet
|
Thank you for your answer!
@sousa9g That's how the database check works. It goes through all present update SQL scripts from old to new without any knowledge that a later statement again modifies the same thing. E.g. the database checker can't handle if an index is removed and later added back, or a column is removed and later added back, or vice versa.
Therefore when such a thing happened, we had to comment out the statement in the old SQL skript (and ship it in the update package as we ship them all).
In your case it would be to comment out the statement in the 1.0.0.sql:
If you check update SQL scripts of the CMS core for version 3.10 you will find some examples of that.
Let me know if this helps you, and close this issue if you are ok with it.
Thanks in advance.