2

This question has been asked a few times but no excepted answers, and none of the suggestions worked for me. Here is the error:

1 exception(s):
Exception #0 (Magento\Framework\Exception\LocalizedException): Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory. 
The following modules are outdated:
Dope_CustomModule data: current version - none, required version - 1.0.0

Seems simple and the error says to run setup:upgrade. Of course I already did that when I installed my module.

I originally had a typo in my registration.php where I put Dopes_CustomModule instead of Dope_CustomModule. Magento 2 seems to hate when I rename themes and modules and so I suspect the typo may have caused this problem to persist. The setup:upgrade process still went through without error (the error shows up on page load to be clear).

I've cleared pub/static/*, var/di/* var/generation/*, var/cache/* and I've triple checked for typos in the code. I enabled/re-enabled several times, I recompiled. Nothing.

I've tried a few times and I notice that the data_version column in my setup_module is always NULL, resulting in the above error. If I change the NULL value of the data_version column in the DB from anything but NULL, including an empty string, my page loads. I did check into this any further, it should be obvious that this "fix" is not really a fix and I'd like something that doesn't require digging into the db, but maybe that helps answer the question.

So why is data_version NULL and why am I getting the above error?

# File: module.xml:
<?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="Dope_CustomModule" setup_version="1.0.0"/>
</config>

developer mode Running Magento 2.1.0 CE locally

1
  • Remove entry of data_version for your module from setup_module and then run upgrade command. Feb 2, 2017 at 1:42

2 Answers 2

3

Go to setup_module Table

Find your module Dope_CustomModule.

Make sure schema_version & data_version should be same as per your current module.

Then run

php bin/magento setup:upgrade

Everything works fine

0
0

Ok my issue was pretty dumb in the end but here is the answer.

The issue came out of my "simple" module having an issue in it's setup. I included a file, Setup/InstallData.php which was copied and modified from an apparently outdated tutorial.

Although I never found the exact issue with my setup, I realized it was causing the problem when I removed the file completely on a whim. Rather than giving me a useful error pointing to the InstallData.php, I got the problem mentioned in this question, hence the confusion. I then found a more reliable source for the InstallData.php that did what I needed it to do.

So I hope this helps someone with a similar issue. Most people will probably find Ankit Shah's answer to be more relevant but it was not what I was looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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