8

I'm getting the following error when I try to install my extension.

Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory. 
The following modules are outdated:
Mymodule_Example data: current version - none, required version - 2.0.0

The database entry in setup_module looks like this:

enter image description here

This is my module.xml file:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Mymodule_Example" setup_version="2.0.0">
</module>
</config>

Is there something I'm missing to ensure the data version gets added to the DB? A result of this also means my setup scripts aren't running.

2
  • How do you enable the module?
    – KAndy
    Dec 9, 2015 at 15:35
  • CLi: php bin/magento module:disable Mymodule_Example
    – Adam Moss
    Dec 9, 2015 at 15:45

6 Answers 6

4

You already have right solution :)

Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory

In Magento1 data_version field was updated on each application call according to to it's value in config.xml.

In Magento2 you should do it manually. This on-demand approach helps to avoid such version checks during each application call.

4

Go and check "setup_module" table, the data_version is "null".

This is happens because of something wrong while running "bin/magento setup:upgrade"

So you have to fix the error then everything ok.

Temporary solution: Login to Mysql database => then update table setup_module of the "data_version" column same as "schema_version"

1
  • This solution worked perfect. Aug 26, 2022 at 13:47
3

This should work, you just need to execute following commands on terminal from magento root directory -

rm -rf pub/static/*
php bin/magento setup:static-content:deploy

After that set 777 permission to your magento root folder recursively.

You also need to delete setup row, to do that open setup_module table in your database and delete your module entry if exist.

Then run this command to register your module -

php bin/magento setup:upgrade --keep-generated

Your may clear cache if required.

1
1

Just update your setup_module table with the required version, or delete in case of NULL required.

In your case, just put 2.0.0 on data column.

0

Create file registration.php in a your extension root directory. In example: app/code/Namespace/Modulename/registration.php

<?php
 \Magento\Framework\Component\ComponentRegistrar::register(
 \Magento\Framework\Component\ComponentRegistrar::MODULE,
 'Namespace_Modulename',
 __DIR__
 );
0

In case it might be helpful to anyone, aside from the above correct answers: I encountered this issue after manually deleting the module record in setup_module and then running setup:upgrade manually. It turned out that setup:upgrade failed, so a new record in setup_module was not created.

In case you're running a script like me that runs setup:upgrade in this case, make sure the action was successful, and the module actually appears in setup_module.

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.