I am working on an extension right now that needs to have a URL rewrite setup when it is installed. Is the best place to do this in a data install script? If not, where should this be done?
It's not a big difference.
From what I saw, how Magento does, if you plan to use direct inserts, place your script in the
sql install script.
If you plan to use models and the internal model API you should put it in the
Here are some examples. In the customer module in
sql/.../install-184.108.40.206.php there is this:
$installer->getConnection()->insertForce($installer->getTable('customer/customer_group'), array( 'customer_group_id' => 0, 'customer_group_code' => 'NOT LOGGED IN', 'tax_class_id' => 3 ));
In the catalog model there is this in
Mage::getModel('catalog/category') ->load(1) ->setId(1) ->setStoreId(0) ->setPath(1) ->setLevel(0) ->setPosition(0) ->setChildrenCount(0) ->setName('Root Catalog') ->setInitialSetupFlag(true) ->save();
I forgot one thing. The upgrade scripts are executed when the modules are initialized and the data upgrades are executed a little later after the current store is initialized, after the full config is loaded, the translates are already loaded and others.
Based on this you can see what works for you best.