0

whats wrong in my install file? InstallSchema.php

public function install(\Magento\Framework\Setup\SchemaSetupInterface $setup, \Magento\Framework\Setup\ModuleContextInterface $context)
{


    $installer = $setup;
    $installer->startSetup();
    if (!$installer->tableExists('tbl_crud_items')) {
        $table = $installer->getConnection()->newTable(
            $installer->getTable('tbl_crud_items')
        )
            ->addColumn(
                'item_id',
                \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
                null,
                [
                    'identity' => true,
                    'nullable' => false,
                    'primary'  => true,
                    'unsigned' => true,
                ],
                'Item ID'
            )
            ->addColumn(
                'name',
                \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                255,
                ['nullable => false'],
                'Item Name'
            )
            ->addColumn(
                'post_content',
                \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                '64k',
                [],
                'Item Content'
            )
            ->addColumn(
                'status',
                \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
                1,
                [],
                'Item Status'
            )
            ->addColumn(
                'featured_image',
                \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                255,
                [],
                'Item Featured Image'
            )
            ->addColumn(
                'created_at',
                \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
                null,
                ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],
                'Created At'
            )->addColumn(
                'updated_at',
                \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
                null,
                ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE],
                'Updated At')
            ->setComment('Item Table');
        $installer->getConnection()->createTable($table);

        $installer->getConnection()->addIndex(
            $installer->getTable('tbl_crud_items'),
            $setup->getIdxName(
                $installer->getTable('tbl_crud_items'),
                ['name', 'post_content', 'featured_image'],
                \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_FULLTEXT
            ),
            ['name', 'post_content','featured_image'],
            \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_FULLTEXT
        );
    }
    $installer->endSetup();
}
7
  • what is your magento version? Commented Oct 19, 2021 at 11:08
  • after adding you have to run this command php bin/magento setup:upgrade ? Commented Oct 19, 2021 at 11:14
  • also, check on the setup_module table on database. is that any entry available for your extension? Commented Oct 19, 2021 at 11:17
  • @viru problem is with setup_module please write answer)) Commented Oct 19, 2021 at 11:34
  • please delete your module entry/record from setup_module and run php bin/magento setup:upgrade Commented Oct 19, 2021 at 11:35

1 Answer 1

0

Please delete your module entry/record from setup_module and run

php bin/magento setup:upgrade –

0

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.