cancel
Showing results for 
Search instead for 
Did you mean: 

Custom module not registered in setup_module table

SOLVED

Custom module not registered in setup_module table

Hi,

I have been working in a custome module at app/code folder. This module is about a new payment method.

Everything works fine. The module is displaying in the payment options.

Now I need to create a custome table to insert some data , so I started creating the files in "setup" folder. Some files need to know my module version, so I change the "module.xml" file to set "setup_version" tag. When I do that an error start to appear: SantanderPay_ModuloEnvio schema: current version - none, required version - 1.0.0. Is in this moment that I realice that my custome module is not listed in the setup_module table.

I don't know why my module is working but is not registered in the table.

Any suggest?

 

Regards

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Custom module not registered in setup_module table

Hello @josefroimoa1df 

 

You should use db_schema.xml for create new table.
Follow below steps:
1. Create file db_schema.xml in "app/code/VendoreName/ModuleName/etc"

 

db_schema.xml

<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
    <table name="declarative_table">
        <column xsi:type="int" name="id_column" padding="10" unsigned="true" nullable="false" comment="Entity Id"/>
        <column xsi:type="int" name="severity" padding="10" unsigned="true" nullable="false" comment="Severity code"/>
        <column xsi:type="varchar" name="title" nullable="false" length="255" comment="Title"/>
        <column xsi:type="timestamp" name="time_occurred"  comment="Time of event"/>
        <column xsi:type="mediumtext" name="desc" nullable="true" comment="Value"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="id_column"/>
        </constraint>
   </table>
</schema>

 

 

2. Run this Command after installing table

 

php bin/magento setup:db-declaration:generate-whitelist --module-name=Vendor_Module
php bin/magento setup:upgrade

 

 

Problem solved? Click Accept as Solution!

View solution in original post

1 REPLY 1

Re: Custom module not registered in setup_module table

Hello @josefroimoa1df 

 

You should use db_schema.xml for create new table.
Follow below steps:
1. Create file db_schema.xml in "app/code/VendoreName/ModuleName/etc"

 

db_schema.xml

<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
    <table name="declarative_table">
        <column xsi:type="int" name="id_column" padding="10" unsigned="true" nullable="false" comment="Entity Id"/>
        <column xsi:type="int" name="severity" padding="10" unsigned="true" nullable="false" comment="Severity code"/>
        <column xsi:type="varchar" name="title" nullable="false" length="255" comment="Title"/>
        <column xsi:type="timestamp" name="time_occurred"  comment="Time of event"/>
        <column xsi:type="mediumtext" name="desc" nullable="true" comment="Value"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="id_column"/>
        </constraint>
   </table>
</schema>

 

 

2. Run this Command after installing table

 

php bin/magento setup:db-declaration:generate-whitelist --module-name=Vendor_Module
php bin/magento setup:upgrade

 

 

Problem solved? Click Accept as Solution!