I have a large SQL file. Can I use this in my module installer?
How to Use a .sql File in Magento Module Installer
databasemagento-1modulesetup-scriptsql
databasemagento-1modulesetup-scriptsql
I have a large SQL file. Can I use this in my module installer?
Best Answer
Yes, if you follow the naming conventions for install scripts. For example:
Or as data install script (if you are not adding/changing tables):app/code/local/Your/Module/data/your_module_setup/data-install-1.0.0.sql app/code/local/Your/Module/data/your_module_setup/data-upgrade-1.0.0-1.0.1.sqlUpdate: for data install scripts, the SQL extension is not working.
You need to define the setup resource
your_module_setup
and the current version number in the module's config.xml like this:Clarification: Magento looks for files with this pattern that either end in ".php" or ".sql", you should only have one of them per upgrade, but not both.
If you want to know how they are executed, see Mage_Core_Model_Resource_Setup::modifyResourceDb()