I'm trying to figure out why I am getting this error when my Magento module tries to install itself:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'export_sent' for key 'PRIMARY'
I think the module is trying to install itself more than once for some reason, since each time it runs, a value is inserted into sales_order_status table. The first instruction runs and then it seems like the code keeps repeating itself. Not sure what is going on. Any help is more than appreciated! BTW I did delete the value export_sent from the table before running this install.
My module's config.xml:
<config>
<modules>
<Millena_Export>
<version>0.1.0</version>
</Millena_Export>
</modules>
<global>
<models>
<millena_export>
<class>Millena_Export_Model</class>
</millena_export>
</models>
<helpers>
<export>
<class>Millena_Export_Helper</class>
</export>
</helpers>
<resources>
<export_setup>
<setup>
<module>Millena_Export</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</export_setup>
<export_write>
<connection>
<use>core_write</use>
</connection>
</export_write>
<export_read>
<connection>
<use>core_read</use>
</connection>
</export_read>
</resources>
</global>
<crontab>
<jobs>
<millena_export_send_all>
<schedule><cron_expr>* * * * *</cron_expr></schedule>
<run><model>millena_export/observer::exportOrderData</model></run>
</millena_export_send_all>
</jobs>
</crontab>
</config>
and my sql/export_setup/mysql4-install-0.1.0.php:
$installer = $this;
$installer->startSetup();
$installer->run("
INSERT INTO `{$this->getTable('sales/order_status')}` (
`status` ,
`label`
) VALUES (
'export_sent', 'Exported to Mainframe'
);
INSERT INTO `{$this->getTable('sales/order_status_state')}' (
`status` ,
`state` ,
`is_default`
) VALUES (
'export_sent', 'processing', '0'
);
INSERT INTO `{$this->getTable('sales/order_status')}` (
`status` ,
`label`
) VALUES (
'export_acknowledged', 'Acknowledged by Mainframe'
);
INSERT INTO `{$this->getTable('sales/order_status_state')}' (
`status` ,
`state` ,
`is_default`
) VALUES (
'export_acknowledged', 'processing', '0'
);
");
$installer->endSetup();