本文整理匯總了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);
}