You have to keepBelow code in your InstallSchema .php file and run upgrade command, php bin/magento setup:upgrade <?php
namespace MonModule\AdminPage\Setup;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
class InstallSchema implements InstallSchemaInterface
{
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
$table = $installer->getConnection()
->newTable($installer->getTable('table-i-want-to-create'))
->addColumn('id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 11,['auto_increment' => true, 'nullable' => false, 'primary' => true], 'ID')
->addColumn('id_shop', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 11, ['nullable' => false], 'Title')
->addColumn('name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 64, ['nullable' => false, 'default' => ''], 'Name')
->addColumn('shipping', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['nullable' => false], 'Shipping')
->addColumn('warranty', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 11, ['nullable' => false], 'Warranty')
->addColumn('full_attributes', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 1, ['nullable' => false], 'Full_attributes')
->setComment('News Table')
->setOption('type', 'InnoDB')
->setOption('charset', 'utf8');
$installer->getConnection()->createTable($table);
$installer->endSetup();
}
} In your code so many bugs like you have defined Varchar and double, whose value are not taken in magento 2 you can use alternate value decimal and text data type for those. Second error was you have keep field as not null and set default value as null. ex. ['nullable' => false, 'default' => ''] this is not valid. Please let me know if you have query. If issue solved, click Kudos and Accept as Solution.
... View more