Showing results for 
Search instead for 
Did you mean: 

Install Schema Not Working


Re: Install Schema Not Working

I have using all your code and try to create table and module...

1. Please add setup_version in module.xml file

<?xml version="1.0"?>
<config xmlns:xsi=""
<module name="Test_Module" setup_version="0.0.1">
<module name="Magento_Catalog"/>

 2. Please add these two line in your InstallSchema.php code..

$installer = $setup;



namespace Test\Module\Setup;

use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Setup\Exception;

class InstallSchema implements InstallSchemaInterface
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
$installer = $setup;


try {
$table = $setup->getConnection()
['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
'Test ID'
['nullable' => false, 'default' => ''],
'Test Content'
)->setComment("Test Custom table");
} catch(Exception $err) {

 Once the extension is created, then we are creating installSchema.php file after executing the extension. Therefore, we have deleted the module form setup_module table and again run the command ....

php bin/magento setup:upgrade

php bin/magetno setup:static-content:deploy -f

php bin/magento cache:flush