What folder should I put my sql files in my component for joomla execute them automatically? If in the first version I created a table and in later version I want to change, how should I organize that files such that joomla know what files it must execute?How does joomla manage these files?

2 Answers 2


As Milton already wrote you specify where those SQL files are in the install manifest file. There are three different locations for install, uninstall and update.

        <file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
        <file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file>
        <schemapath type="mysql">sql/updates/mysql</schemapath>

As you see, the update one is a bit special as it doesn't specify a single file but a folder. In this folder there should be files following your component versions. On an update Joomla will check that folder and apply the commands in the files in the correct order. It stores the latest applied file in the database so it knows on the next update which one was the last one applied. So the folder should contain files named like this:

  • 1.0.0.sql
  • 1.0.1.sql
  • 1.1.0.sql
  • ...
  • 1
    Maybe you could add how to set the component version, otherwise very good answer
    – fruppel
    Commented Apr 24, 2014 at 5:56
  • 2
    Also note you must have a SQL file for each version of your component even if it doesn't contain anything Commented Apr 24, 2014 at 12:02
  • I know it used to be like this, but I'm not sure if it's still the case :)
    – Bakual
    Commented Apr 25, 2014 at 6:17

The convention is usually the admin directory, but beyond that it shouldn't matter as long as you reference the files' location correctly inside of your main xml file.


        <file driver="mysql" charset="utf8">sql/tables/install.sql</file>


        <file driver="mysql" charset="utf8">sql/install.sql</file>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.