I am trying to run some Setup\UpgradeSchema.php lines. I run:

php bin/magento setup:upgrade

And my module code is not executed. My Setup\UpgradeSchema.php looks more or less like this:

    if (version_compare($version, '100.0.24', '<')) {

My module.xmllooks like this:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="My_Module" setup_version="100.0.24">
            <module name="Magento_Sales" />
            <module name="Magento_Quote" />
            <module name="Magento_Catalog" />
            <module name="Magento_Customer" />

My setup_module table looks like this:

Module      | schema_version | data_version
------      | ------         | -----
My_Module   | 100.0.23       | 100.0.23

When I run this on my local machine it works fine, however in my server it does not. The first time I executed it it gave me an error but now it is not, so I suspect of a caching problem. I have flushed the cache, and run:

rm -rf var/cache var/generation/ var/page_cache/ var/di/ var/tmp/ var/view_preprocessed/;

Any ideas why this might be happening? I am using Magento 2.1.7 by the way

  • Just to confirm the setup_module table is taken from your local machine or the server? – Kristof at Fooman Jun 30 '17 at 0:31
  • From the server – awavi Jun 30 '17 at 3:15
  • Did you drop log on Setup\UpgradeSchema.php? – PY Yick Jun 30 '17 at 3:41
  • I do not find any log – awavi Jun 30 '17 at 4:04

Ok. The problem was I was pointing another db Schema. So the schema_version and data_version were equal to my module's.

| improve this answer | |

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.