databasemagentomagento-1.6

Magento reset one module database


I messed up with a module, how can I reset it's tables (not empty, but reset) like it is fresh installed? I don't wont to reinstall the module, I just want to reset the data in database.

Magento Version: 1.6.0


Solution

  • To reset a module data, you have to delete it's resource related entry, this way magento will rerun setup script again.

    Example: Let's say you want to reset the newsletter module data.

    If you check

    app/core/Mage/Newsletter/etc/config.etc
    

    You can find

    <resources>
        <newsletter_setup>
            <setup>
                <module>Mage_Newsletter</module>
            </setup>
        </newsletter_setup>
    </resources>
    

    This means the resource name is newsletter_setup

    Log in to your database, find the table core_resource, find the entry where the code = newsletter_setup delete it.

    Now if you refresh the page, Magento will run the setup script again, in this case, it is

    app/core/Mage/Newsletter/etc/sql/install-1.6.0.0.php