2017-09-22 6 views
0

私はmagneto2でカスタムモジュールを作成しました。installschemaを使用してdbテーブルを作成しない

モジュールが有効でセットアップファイルがsetup_moduleテーブルに作成されました。 テーブルは作成されませんでした。私はmagnetoを使用しています2.0.3バージョン

これは私のInstallSchema.phpファイルです。

<?php 

    namespace Magento\Bundle\Setup; 

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

    class InstallSchema implements InstallSchemaInterface 
    { 
     /** 
     * {@inheritdoc} 
     * @SuppressWarnings(PHPMD.ExcessiveMethodLength) 
     */ 
     public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) 
     { 
      $installer = $setup; 

      $installer->startSetup(); 
      $table = $installer->getConnection() 
       ->newTable($installer->getTable('test_sample')) 
       ->addColumn(
        'id', 
        \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 
        null, 
        ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 
        'Id' 
       ) 
       ->addColumn(
        'name', 
        \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 
        null, 
        [], 
        'name' 
       ) 
       ->setComment('testing'); 

      $installer->getConnection()->createTable($table); 
      $installer->endSetup(); 
     } 
    } 

答えて

0

テーブルを作成するためのコードは正常です。 しかし、私はファイルがロードされて実行されないと思う。私が見ることができるからnamespace Magento\Bundle\Setup;これはあなたのカスタムモジュールにある場合は間違っています。

関連する問題