0

I'm fairly sure I'm missing something obvious here, but I can't see it.

I've added an install script to a module I've built, I've double checked it against Alan Storm's excellent tutorial, and I'm sure everything is correct, but it won't play ball.

I'm clearing the entry from core_resource each time, and I'm clearing the cache (all of the cache is disabled anyway, but I'm clearing it for good measure!!)

config.xml looks like this:

<?xml version="1.0"?>
<config>
      <modules>
            <Lw_Restrict>
                  <version>1.0.0</version>
            </Lw_Restrict>
      </modules>
      <global>
            <resources>
                  <restrict_setup>
                        <setup>
                              <module>Lw_Restrict</module>
                              <class>Lw_Restrict_Model_Resource_Mysql4_Setup</class>
                        </setup>
                        <connection>
                              <use>core_setup</use>
                        </connection>
                  </restrict_setup>
            </resources>
      </global>
</config>

./app/code/local/Lw/Restrict/Model/Resource/Mysql4/Setup.php

<?php

class Lw_Restrict_Model_Resource_Mysql4_Setup extends Mage_Core_Model_Resource_Setup {


}

./app/code/local/Lw/Restrict/sql/restrict_setup/mysql4-install-1.0.0.php

<?php

die("Noop");

The install script was previously more complicated, adding attributes etc, but I stripped it back to this test just to make sure it wasn't that.

What happens when I clear everything and run this is that the site loads as normal, a row is added to core_resource, but it doesn't die (and previously it didn't add the attributes)

If someone can point out what I'm missing that'd be great!!!

1

Have you deleted the reference in the database to your module's version number?

It should be in the core_resource table under restrict_setup

If so, perhaps try <lw_restrict_setup> rather than <restrict_setup> and remove the <connection> tag altogether.

Also, rename the restrict_setup folder in

/app/code/local/Lw/Restrict/sql/restrict_setup/mysql4-install-1.0.0.php

to

lw_restrict_setup

and then add within your <global> tag:

<models>
    <restrict_setup>
        <restrict>
            <class>Lw_Restrict_Model</class>
        </restrict>
    </restrict_setup>
</models>
  • 1
    Thanks - didn't need to add to <models>, but made your other suggested changes and it worked! – Liam Wiltshire May 18 '15 at 22:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.