Database version not in sync on my component? #1269

Open
opened 2025-11-03 19:19:00 +00:00 by Tom van der Laan · 6 comments
Member

Steps to reproduce the issue

I have no clue. i only know that on my extension it is not matching. And i don't know how to fix this. I'm sure it's a setting somewhere.

Expected result

database structure is up-to-date.

Actual result

database version is always one behind.

System information (as much as possible)

  • OS Name & Version:
  • MySql Version:
  • Apache Version:
  • PHP Version:
  • Joomla Version:
  • JCB Version: 6.1.4-alpha 4
  • Browser:

Additional comments

### Steps to reproduce the issue I have no clue. i only know that on my extension it is not matching. And i don't know how to fix this. I'm sure it's a setting somewhere. ### Expected result database structure is up-to-date. ### Actual result database version is always one behind. ### System information (as much as possible) - OS Name & Version: - MySql Version: - Apache Version: - PHP Version: - Joomla Version: - JCB Version: 6.1.4-alpha 4 - Browser: ### Additional comments
Author
Member

oh i should've defined the url that is from since there is not much context in the image: https://domain.com/administrator/index.php?option=com_installer&view=database

oh i should've defined the url that is from since there is not much context in the image: https://domain.com/administrator/index.php?option=com_installer&view=database
Owner

I've encountered this issue as well, though I'm not entirely sure of its origin—it might be due to a recent change in Joomla or possibly a misunderstanding on my part. I'd really appreciate some help investigating it.

If you're able to look into it and share your findings, that would be great. I'm more than willing to implement the necessary fix once we pinpoint the cause. I'm currently focusing on other parts of the project, so any assistance with the initial legwork would definitely help move things along faster.

I've encountered this issue as well, though I'm not entirely sure of its origin—it might be due to a recent change in Joomla or possibly a misunderstanding on my part. I'd really appreciate some help investigating it. If you're able to look into it and share your findings, that would be great. I'm more than willing to implement the necessary fix once we pinpoint the cause. I'm currently focusing on other parts of the project, so any assistance with the initial legwork would definitely help move things along faster.
Author
Member

ok so the file naming is what determines how it is noted (underscore vs . notation).

I also noticed that all extensions are not matching the version. This is probably because the db version is when last time there was a db update (newest sql file) when it processes a sql file with actual sql in it. it updates the schema version number in the schema table. Empty files won't work from what i read.

Also the one error showing in my screenshot is because of a change in a field i did i added a unique index. this generated sql was not being validated correctly by joomla. probably a bug or limitation in the way that joomla is processing the sql and checking it against the db is my assumption.

ok so the file naming is what determines how it is noted (underscore vs . notation). I also noticed that all extensions are not matching the version. This is probably because the db version is when last time there was a db update (newest sql file) when it processes a sql file with actual sql in it. it updates the schema version number in the schema table. Empty files won't work from what i read. Also the one error showing in my screenshot is because of a change in a field i did i added a unique index. this generated sql was not being validated correctly by joomla. probably a bug or limitation in the way that joomla is processing the sql and checking it against the db is my assumption.
Member

Just tested with JCB 6.1.4-alpha5:

  1. Create and install brand new component (no copying, new admin view)
  2. Install Component
    afbeelding.png
    New entry is created in #__schemas table of Joomla but with an empty value
  3. Create new field for admin view and compile -> install
    afbeelding.png
    Second entry is created in Schemas table
  4. Check administrator -> Maintenance -> Database
    afbeelding.png

This is done on a clean J6 install and a clean JCB 6.1.4-alpha5 install. It seems like the remaining empty row in the schemas table is causing some trouble. Manually removing the row with the empty version solves the issues on te Maintenance page

Just tested with JCB 6.1.4-alpha5: 1) Create and install brand new component (no copying, new admin view) 2) Install Component ![afbeelding.png](/attachments/65cfb845-c6a2-4a13-9fb5-e4962959d707) New entry is created in #__schemas table of Joomla but with an empty value 3) Create new field for admin view and compile -> install ![afbeelding.png](/attachments/3db0f33a-712f-40d0-a780-d32f86b96cf4) Second entry is created in Schemas table 4) Check administrator -> Maintenance -> Database ![afbeelding.png](/attachments/1eb324c4-6a95-443d-b002-8b3ae08941fe) This is done on a clean J6 install and a clean JCB 6.1.4-alpha5 install. It seems like the remaining empty row in the schemas table is causing some trouble. Manually removing the row with the empty version solves the issues on te Maintenance page
Member

I had a look and found an issue and a possible solution:

Short version:
There is no 1.0.0 mysql file created when a component is compiled for the first time. The Joomla InstallerAdapter at some point calls parseQueries which in turns calls setSchemaVersion where a bug(?) happens. setSchemaVersion expects there to be a file in the mysql (or orther db driver folder), and when none are found an incorrect row in the #__schemas table is added. Adding a 1_0_0.sql file to the admin\sql\updates\mysql folder creates a correct value in the #__schemas table.

Long version:
(comments are mine)
afbeelding.png

Seems like there needs to be at least 1 sql file when installing a component when the mode 'update' is selected in the component manifest file since the parseQueries function checks for that
afbeelding.png

I had a look and found an issue and a possible solution: Short version: There is no 1.0.0 mysql file created when a component is compiled for the first time. The Joomla InstallerAdapter at some point calls `parseQueries` which in turns calls `setSchemaVersion` where a bug(?) happens. `setSchemaVersion` expects there to be a file in the mysql (or orther db driver folder), and when none are found an incorrect row in the #__schemas table is added. Adding a 1_0_0.sql file to the admin\sql\updates\mysql folder creates a correct value in the #__schemas table. Long version: (comments are mine) ![afbeelding.png](/attachments/ced6f7f5-3f02-42af-8860-0be8f09e4237) Seems like there needs to be at least 1 sql file when installing a component when the mode 'update' is selected in the component manifest file since the `parseQueries` function checks for that ![afbeelding.png](/attachments/39726c27-2848-422b-a41e-38a268f7acbc)
Member

The Joomla documenation says that install is the default, and it'll stop processing if files are already found.
afbeelding.png
So after looking at the code the 'update' mode in the component manifest expects there to be at least 1 update file. Therefore the first initial build of a component (according to how i interpret this documentation) MUST use install, and any subsequent versions can use update

The Joomla documenation says that install is the default, and it'll stop processing if files are already found. ![afbeelding.png](/attachments/fdc57e8a-478f-4692-a31c-b923963c666b) So after looking at the code the 'update' mode in the component manifest expects there to be at least 1 update file. Therefore the first initial build of a component (according to how i interpret this documentation) MUST use install, and any subsequent versions can use update
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: joomla/Component-Builder#1269