本文整理汇总了PHP中Magento\Framework\Setup\SchemaSetupInterface::tableExists方法的典型用法代码示例。如果您正苦于以下问题:PHP SchemaSetupInterface::tableExists方法的具体用法?PHP SchemaSetupInterface::tableExists怎么用?PHP SchemaSetupInterface::tableExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Setup\SchemaSetupInterface
的用法示例。
在下文中一共展示了SchemaSetupInterface::tableExists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addSupportVideoMediaAttributes
/**
* @param SchemaSetupInterface $setup
* @return void
*/
private function addSupportVideoMediaAttributes(SchemaSetupInterface $setup)
{
if ($setup->tableExists(Media::GALLERY_VALUE_TO_ENTITY_TABLE)) {
return;
}
/** Add support video media attribute */
$this->createValueToEntityTable($setup);
/**
* Add media type property to the Gallery entry table
*/
$setup->getConnection()->addColumn($setup->getTable(Media::GALLERY_TABLE), 'media_type', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 32, 'nullable' => false, 'default' => ImageEntryConverter::MEDIA_TYPE_CODE, 'comment' => 'Media entry type']);
$setup->getConnection()->addColumn($setup->getTable(Media::GALLERY_TABLE), 'disabled', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'unsigned' => true, 'nullable' => false, 'default' => 0, 'comment' => 'Visibility status']);
/**
* Drop entity Id columns
*/
$setup->getConnection()->dropColumn($setup->getTable(Media::GALLERY_TABLE), 'entity_id');
/**
* Drop primary index
*/
$setup->getConnection()->dropForeignKey($setup->getTable(Media::GALLERY_VALUE_TABLE), $setup->getFkName(Media::GALLERY_VALUE_TABLE, 'value_id', Media::GALLERY_TABLE, 'value_id'));
$setup->getConnection()->dropForeignKey($setup->getTable(Media::GALLERY_VALUE_TABLE), $setup->getFkName(Media::GALLERY_VALUE_TABLE, 'store_id', 'store', 'store_id'));
$setup->getConnection()->dropIndex($setup->getTable(Media::GALLERY_VALUE_TABLE), 'primary');
$setup->getConnection()->addColumn($setup->getTable(Media::GALLERY_VALUE_TABLE), 'record_id', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 'primary' => true, 'auto_increment' => true, 'unsigned' => true, 'nullable' => false, 'comment' => 'Record Id']);
/**
* Add index 'value_id'
*/
$setup->getConnection()->addIndex($setup->getTable(Media::GALLERY_VALUE_TABLE), $setup->getConnection()->getIndexName($setup->getTable(Media::GALLERY_VALUE_TABLE), 'value_id', 'index'), 'value_id');
$this->addForeignKeys($setup);
}