How to use modular SQL in your XML manifest
Photo from Unsplash

About 5mn to read

They are red sequentially following the order in the xml manifest file of

...
Read more:

They are red sequentially following the order in the xml manifest file of your component

Here is an example. Pay close attention to the install part.

<!--?xml version="1.0" encoding="utf-8"?-->
<extension type="component" version="3.9" method="upgrade" client="administrator">
    <name>com_modularsqlexample</name>
    <author>example</author>
    <creationdate>0000-00-00</creationdate>
    <copyright>(C) example. All rights reserved.</copyright>
    <license>http://www.gnu.org/copyleft/gpl.html</license>
    <authoremail>This email address is being protected from spambots. You need JavaScript enabled to view it.</authoremail>
    <authorurl>example.com</authorurl>
    <version>1.0.0</version>
    <description>Example Joomla! component with separated install SQL files running in order presented in this manifest file</description>

    <install>
        <sql>
            <file driver="mysql" charset="utf8">sql/install.sql</file>
            <file driver="mysql" charset="utf8">sql/data-step-1.sql</file>
            <file driver="mysql" charset="utf8">sql/data-step-2.sql</file>
            <file driver="mysql" charset="utf8">sql/data-step-3.sql</file>
            <file driver="mysql" charset="utf8">sql/data-final-step.sql</file>
        </sql>
    </install>

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

    <update>
        <schemas>
            <schemapath type="mysql">sql/updates/mysql</schemapath>
        </schemas>
    </update>
    
    <administration><menu>COM_MODULARSQLEXAMPLE</menu>

        <files folder="admin">
            <filename>index.html</filename>
            <filename>modularsqlexample.php</filename>
        </files>
    </administration>
</extension>