magento / marketplace-eqp

Magento 1.x Coding Standard
http://docs.magento.com/marketplace/user_guide/Resources/pdf/Extension_Quality_Program_Overview.pdf
MIT License
224 stars 68 forks source link

Modification of magento database core table 'id' #94

Closed alxsuchakin closed 5 years ago

alxsuchakin commented 6 years ago

Adding column 'id' in custom table in InstallSchema.php file cause this warning.

Modification of magento database core table 'id'

`$setup->startSetup();

    $table = $setup->getConnection()->newTable(
        $setup->getTable('custom_table')
    )->addColumn(
        'id',
        \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
        null,
        ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
        'Id'
    )->addColumn(
        'zip_code',
        \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
        64,
        [],
        'Zip Code'
    )->addColumn(
        'state',
        \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
        255,
        [],
        'State'
    )->addColumn(
        'region_id',
        \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
        null,
        ['unsigned' => true, 'nullable' => false],
        'Region ID'
    )->addColumn(
        'created_at',
        \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
        255,
        [],
        'Created At'
    )->addIndex(
        $setup->getIdxName('custom_table', ['zip_code']),
        ['zip_code']
    )->setComment(
        'Stainmaster Zip Code'
    )->addForeignKey(
        $setup->getFkName(
            'custom_table',
            'region_id',
            'directory_country_region',
            'region_id'
        ),
        'region_id',
        $setup->getTable('directory_country_region'),
        'region_id',
        \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
    );

    $setup->getConnection()->createTable($table);

    $setup->endSetup();`

If 'id' column change to something else warning will gone.

lenaorobei commented 5 years ago

Closing this issue because this repo now contains sniffs for Magento 1.x code only. Please refer to magento/magento-coding-standard for Magento 2.x coding standard.

This rule was removed in magento/magento-coding-standard in order to eliminate false-positive findings.