本文整理汇总了PHP中Magento\Framework\Setup\SchemaSetupInterface类的典型用法代码示例。如果您正苦于以下问题:PHP SchemaSetupInterface类的具体用法?PHP SchemaSetupInterface怎么用?PHP SchemaSetupInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SchemaSetupInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: install
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
if (!$installer->tableExists('gemtoo_blog_article')) {
$table = $installer->getConnection()->newTable($installer->getTable('gemtoo_blog_article'));
$table->addColumn('article_id', Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Article ID')->addColumn('name', Table::TYPE_TEXT, 255, ['nullable' => false], 'Article Name')->addColumn('url_key', Table::TYPE_TEXT, 255, ['nullable' => false], 'Article Url Key')->addColumn('content', Table::TYPE_TEXT, '2M', [], 'Article Content')->addColumn('dop', Table::TYPE_DATE, null, [], 'Article Date')->addColumn('type', Table::TYPE_INTEGER, null, [], 'Article Type')->addColumn('image', Table::TYPE_TEXT, 255, [], 'Article Image')->addColumn('file', Table::TYPE_TEXT, 255, [], 'Article File')->addColumn('meta_title', Table::TYPE_TEXT, 255, [], 'Article Meta Title')->addColumn('meta_description', Table::TYPE_TEXT, '2M', [], 'Article Meta Description')->addColumn('meta_keywords', Table::TYPE_TEXT, '2M', [], 'Article Meta Keywords')->addColumn('is_active', Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '1'], 'Is Article Active')->addColumn('in_rss', Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '1'], 'Show in rss')->addColumn('updated_at', Table::TYPE_TIMESTAMP, null, [], 'Update at')->addColumn('created_at', Table::TYPE_TIMESTAMP, null, [], 'Creation Time')->setComment('Blog articles');
$installer->getConnection()->createTable($table);
$installer->getConnection()->addIndex($installer->getTable('gemtoo_blog_article'), $setup->getIdxName($installer->getTable('gemtoo_blog_article'), ['name', 'photo'], AdapterInterface::INDEX_TYPE_FULLTEXT), ['name', 'content', 'url_key', 'file', 'meta_title', 'meta_keywords', 'meta_description'], AdapterInterface::INDEX_TYPE_FULLTEXT);
}
//Create Articles to Store table
if (!$installer->tableExists('gemtoo_blog_article_store')) {
$table = $installer->getConnection()->newTable($installer->getTable('gemtoo_blog_article_store'));
$table->addColumn('article_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Article ID')->addColumn('store_id', Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Store ID')->addIndex($installer->getIdxName('gemtoo_blog_article_store', ['store_id']), ['store_id'])->addForeignKey($installer->getFkName('gemtoo_blog_article_store', 'article_id', 'gemtoo_blog_article', 'article_id'), 'article_id', $installer->getTable('gemtoo_blog_article'), 'article_id', Table::ACTION_CASCADE)->addForeignKey($installer->getFkName('gemtoo_blog_article_store', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', Table::ACTION_CASCADE)->setComment('Article To Store Link Table');
$installer->getConnection()->createTable($table);
}
if (!$installer->tableExists('gemtoo_blog_article_product')) {
$table = $installer->getConnection()->newTable($installer->getTable('gemtoo_blog_article_product'));
$table->addColumn('article_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Article ID')->addColumn('product_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Product ID')->addColumn('position', Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '0'], 'Position')->addIndex($installer->getIdxName('gemtoo_blog_article_product', ['product_id']), ['product_id'])->addForeignKey($installer->getFkName('gemtoo_blog_article_product', 'article_id', 'gemtoo_blog_article', 'article_id'), 'article_id', $installer->getTable('gemtoo_blog_article'), 'article_id', Table::ACTION_CASCADE)->addForeignKey($installer->getFkName('gemtoo_blog_article_product', 'product_id', 'catalog_product_entity', 'entity_id'), 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', Table::ACTION_CASCADE)->addIndex($installer->getIdxName('gemtoo_blog_article_product', ['article_id', 'product_id'], AdapterInterface::INDEX_TYPE_UNIQUE), ['article_id', 'product_id'], ['type' => AdapterInterface::INDEX_TYPE_UNIQUE])->setComment('Article To product Link Table');
$installer->getConnection()->createTable($table);
}
if (!$installer->tableExists('gemtoo_blog_article_category')) {
$table = $installer->getConnection()->newTable($installer->getTable('gemtoo_blog_article_category'));
$table->addColumn('article_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Article ID')->addColumn('category_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Category ID')->addColumn('position', Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '0'], 'Position')->addIndex($installer->getIdxName('gemtoo_blog_article_category', ['category_id']), ['category_id'])->addForeignKey($installer->getFkName('gemtoo_blog_article_category', 'article_id', 'gemtoo_blog_article', 'article_id'), 'article_id', $installer->getTable('gemtoo_blog_article'), 'article_id', Table::ACTION_CASCADE)->addForeignKey($installer->getFkName('gemtoo_blog_article_category', 'category_id', 'catalog_category_entity', 'entity_id'), 'category_id', $installer->getTable('catalog_category_entity'), 'entity_id', Table::ACTION_CASCADE)->addIndex($installer->getIdxName('gemtoo_blog_article_category', ['article_id', 'category_id'], AdapterInterface::INDEX_TYPE_UNIQUE), ['article_id', 'category_id'], ['type' => AdapterInterface::INDEX_TYPE_UNIQUE])->setComment('Article To category Link Table');
$installer->getConnection()->createTable($table);
}
}
开发者ID:pleminh,项目名称:Gemtoo,代码行数:31,代码来源:InstallSchema.php
示例2: install
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
/**
* Create table 'cataloginventory_stock'
*/
$table = $installer->getConnection()->newTable($installer->getTable('cataloginventory_stock'))->addColumn('stock_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Stock Id')->addColumn('website_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 5, ['unsigned' => true, 'nullable' => false], 'Website Id')->addColumn('stock_name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, [], 'Stock Name')->addIndex($setup->getIdxName($installer->getTable('cataloginventory_stock'), ['website_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX), ['website_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX)->setComment('Cataloginventory Stock');
$installer->getConnection()->createTable($table);
/**
* Create table 'cataloginventory_stock_item'
*/
$table = $installer->getConnection()->newTable($installer->getTable('cataloginventory_stock_item'))->addColumn('item_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Item Id')->addColumn('product_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Product Id')->addColumn('stock_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Stock Id')->addColumn('qty', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['unsigned' => false, 'nullable' => true, 'default' => null], 'Qty')->addColumn('min_qty', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['nullable' => false, 'default' => '0.0000'], 'Min Qty')->addColumn('use_config_min_qty', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '1'], 'Use Config Min Qty')->addColumn('is_qty_decimal', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Is Qty Decimal')->addColumn('backorders', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Backorders')->addColumn('use_config_backorders', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '1'], 'Use Config Backorders')->addColumn('min_sale_qty', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['nullable' => false, 'default' => '1.0000'], 'Min Sale Qty')->addColumn('use_config_min_sale_qty', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '1'], 'Use Config Min Sale Qty')->addColumn('max_sale_qty', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['nullable' => false, 'default' => '0.0000'], 'Max Sale Qty')->addColumn('use_config_max_sale_qty', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '1'], 'Use Config Max Sale Qty')->addColumn('is_in_stock', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Is In Stock')->addColumn('low_stock_date', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, [], 'Low Stock Date')->addColumn('notify_stock_qty', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', [], 'Notify Stock Qty')->addColumn('use_config_notify_stock_qty', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '1'], 'Use Config Notify Stock Qty')->addColumn('manage_stock', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Manage Stock')->addColumn('use_config_manage_stock', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '1'], 'Use Config Manage Stock')->addColumn('stock_status_changed_auto', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Stock Status Changed Automatically')->addColumn('use_config_qty_increments', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '1'], 'Use Config Qty Increments')->addColumn('qty_increments', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['nullable' => false, 'default' => '0.0000'], 'Qty Increments')->addColumn('use_config_enable_qty_inc', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '1'], 'Use Config Enable Qty Increments')->addColumn('enable_qty_increments', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Enable Qty Increments')->addColumn('is_decimal_divided', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 5, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Is Divided into Multiple Boxes for Shipping')->addColumn('website_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 5, ['unsigned' => true, 'nullable' => false, 'default' => 0], 'Is Divided into Multiple Boxes for Shipping')->addIndex($installer->getIdxName('cataloginventory_stock_item', ['product_id', 'website_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['product_id', 'website_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addIndex($installer->getIdxName('cataloginventory_stock_item', ['website_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX), ['website_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX])->addIndex($installer->getIdxName('cataloginventory_stock_item', ['stock_id']), ['stock_id'])->addForeignKey($installer->getFkName('cataloginventory_stock_item', 'product_id', 'catalog_product_entity', 'entity_id'), 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($installer->getFkName('cataloginventory_stock_item', 'stock_id', 'cataloginventory_stock', 'stock_id'), 'stock_id', $installer->getTable('cataloginventory_stock'), 'stock_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Cataloginventory Stock Item');
$installer->getConnection()->createTable($table);
/**
* Create table 'cataloginventory_stock_status'
*/
$table = $installer->getConnection()->newTable($installer->getTable('cataloginventory_stock_status'))->addColumn('product_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Product Id')->addColumn('website_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Website Id')->addColumn('stock_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Stock Id')->addColumn('qty', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['nullable' => false, 'default' => '0.0000'], 'Qty')->addColumn('stock_status', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false], 'Stock Status')->addIndex($installer->getIdxName('cataloginventory_stock_status', ['stock_id']), ['stock_id'])->addIndex($installer->getIdxName('cataloginventory_stock_status', ['website_id']), ['website_id'])->setComment('Cataloginventory Stock Status');
$installer->getConnection()->createTable($table);
/**
* Create table 'cataloginventory_stock_status_idx'
*/
$table = $installer->getConnection()->newTable($installer->getTable('cataloginventory_stock_status_idx'))->addColumn('product_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Product Id')->addColumn('website_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Website Id')->addColumn('stock_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Stock Id')->addColumn('qty', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['nullable' => false, 'default' => '0.0000'], 'Qty')->addColumn('stock_status', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false], 'Stock Status')->addIndex($installer->getIdxName('cataloginventory_stock_status_idx', ['stock_id']), ['stock_id'])->addIndex($installer->getIdxName('cataloginventory_stock_status_idx', ['website_id']), ['website_id'])->setComment('Cataloginventory Stock Status Indexer Idx');
$installer->getConnection()->createTable($table);
/**
* Create table 'cataloginventory_stock_status_tmp'
*/
$table = $installer->getConnection()->newTable($installer->getTable('cataloginventory_stock_status_tmp'))->addColumn('product_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Product Id')->addColumn('website_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Website Id')->addColumn('stock_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Stock Id')->addColumn('qty', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['nullable' => false, 'default' => '0.0000'], 'Qty')->addColumn('stock_status', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false], 'Stock Status')->addIndex($installer->getIdxName('cataloginventory_stock_status_tmp', ['stock_id']), ['stock_id'])->addIndex($installer->getIdxName('cataloginventory_stock_status_tmp', ['website_id']), ['website_id'])->setOption('type', \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY)->setComment('Cataloginventory Stock Status Indexer Tmp');
$installer->getConnection()->createTable($table);
$installer->endSetup();
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:35,代码来源:InstallSchema.php
示例3: install
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
/**
* Create table 'cms_block'
*/
$table = $installer->getConnection()->newTable($installer->getTable('cms_block'))->addColumn('block_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Block ID')->addColumn('title', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => false], 'Block Title')->addColumn('identifier', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => false], 'Block String Identifier')->addColumn('content', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '2M', [], 'Block Content')->addColumn('creation_time', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Block Creation Time')->addColumn('update_time', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], 'Block Modification Time')->addColumn('is_active', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['nullable' => false, 'default' => '1'], 'Is Block Active')->addIndex($setup->getIdxName($installer->getTable('cms_block'), ['title', 'identifier', 'content'], AdapterInterface::INDEX_TYPE_FULLTEXT), ['title', 'identifier', 'content'], ['type' => AdapterInterface::INDEX_TYPE_FULLTEXT])->setComment('CMS Block Table');
$installer->getConnection()->createTable($table);
/**
* Create table 'cms_block_store'
*/
$table = $installer->getConnection()->newTable($installer->getTable('cms_block_store'))->addColumn('block_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['nullable' => false, 'primary' => true], 'Block ID')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Store ID')->addIndex($installer->getIdxName('cms_block_store', ['store_id']), ['store_id'])->addForeignKey($installer->getFkName('cms_block_store', 'block_id', 'cms_block', 'block_id'), 'block_id', $installer->getTable('cms_block'), 'block_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($installer->getFkName('cms_block_store', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('CMS Block To Store Linkage Table');
$installer->getConnection()->createTable($table);
/**
* Create table 'cms_page'
*/
$table = $installer->getConnection()->newTable($installer->getTable('cms_page'))->addColumn('page_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Page ID')->addColumn('title', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => true], 'Page Title')->addColumn('page_layout', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => true], 'Page Layout')->addColumn('meta_keywords', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', ['nullable' => true], 'Page Meta Keywords')->addColumn('meta_description', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', ['nullable' => true], 'Page Meta Description')->addColumn('identifier', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 100, ['nullable' => true, 'default' => null], 'Page String Identifier')->addColumn('content_heading', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => true], 'Page Content Heading')->addColumn('content', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '2M', [], 'Page Content')->addColumn('creation_time', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Page Creation Time')->addColumn('update_time', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], 'Page Modification Time')->addColumn('is_active', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['nullable' => false, 'default' => '1'], 'Is Page Active')->addColumn('sort_order', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['nullable' => false, 'default' => '0'], 'Page Sort Order')->addColumn('layout_update_xml', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', ['nullable' => true], 'Page Layout Update Content')->addColumn('custom_theme', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 100, ['nullable' => true], 'Page Custom Theme')->addColumn('custom_root_template', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => true], 'Page Custom Template')->addColumn('custom_layout_update_xml', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', ['nullable' => true], 'Page Custom Layout Update Content')->addColumn('custom_theme_from', \Magento\Framework\DB\Ddl\Table::TYPE_DATE, null, ['nullable' => true], 'Page Custom Theme Active From Date')->addColumn('custom_theme_to', \Magento\Framework\DB\Ddl\Table::TYPE_DATE, null, ['nullable' => true], 'Page Custom Theme Active To Date')->addIndex($installer->getIdxName('cms_page', ['identifier']), ['identifier'])->addIndex($setup->getIdxName($installer->getTable('cms_page'), ['title', 'meta_keywords', 'meta_description', 'identifier', 'content'], AdapterInterface::INDEX_TYPE_FULLTEXT), ['title', 'meta_keywords', 'meta_description', 'identifier', 'content'], ['type' => AdapterInterface::INDEX_TYPE_FULLTEXT])->setComment('CMS Page Table');
$installer->getConnection()->createTable($table);
/**
* Create table 'cms_page_store'
*/
$table = $installer->getConnection()->newTable($installer->getTable('cms_page_store'))->addColumn('page_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['nullable' => false, 'primary' => true], 'Page ID')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Store ID')->addIndex($installer->getIdxName('cms_page_store', ['store_id']), ['store_id'])->addForeignKey($installer->getFkName('cms_page_store', 'page_id', 'cms_page', 'page_id'), 'page_id', $installer->getTable('cms_page'), 'page_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($installer->getFkName('cms_page_store', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('CMS Page To Store Linkage Table');
$installer->getConnection()->createTable($table);
$installer->endSetup();
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:30,代码来源:InstallSchema.php
示例4: uninstall
public function uninstall(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
$connection = $setup->getConnection();
$connection->dropTable($setup->getTable('algoliasearch_queue'));
$setup->endSetup();
}
开发者ID:algolia,项目名称:algoliasearch-magento-2,代码行数:7,代码来源:Uninstall.php
示例5: install
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
if (!$installer->tableExists('sample_news_author')) {
$table = $installer->getConnection()->newTable($installer->getTable('sample_news_author'));
$table->addColumn('author_id', Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Author ID')->addColumn('name', Table::TYPE_TEXT, 255, ['nullable' => false], 'Author Name')->addColumn('url_key', Table::TYPE_TEXT, 255, ['nullable' => false], 'Author Url Key')->addColumn('biography', Table::TYPE_TEXT, '2M', [], 'Author Biography')->addColumn('dob', Table::TYPE_DATE, null, [], 'Author Birth date')->addColumn('awards', Table::TYPE_TEXT, '2M', [], 'Author Awards')->addColumn('type', Table::TYPE_INTEGER, null, [], 'Author Type')->addColumn('avatar', Table::TYPE_TEXT, 255, [], 'Author Avatar')->addColumn('resume', Table::TYPE_TEXT, 255, [], 'Author Resume')->addColumn('country', Table::TYPE_TEXT, 2, [], 'Author Country')->addColumn('meta_title', Table::TYPE_TEXT, 255, [], 'Author Meta Title')->addColumn('meta_description', Table::TYPE_TEXT, '2M', [], 'Author Meta Description')->addColumn('meta_keywords', Table::TYPE_TEXT, '2M', [], 'Author Meta Keywords')->addColumn('is_active', Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '1'], 'Is Author Active')->addColumn('in_rss', Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '1'], 'Show in rss')->addColumn('updated_at', Table::TYPE_TIMESTAMP, null, [], 'Update at')->addColumn('created_at', Table::TYPE_TIMESTAMP, null, [], 'Creation Time')->setComment('News authors');
$installer->getConnection()->createTable($table);
$installer->getConnection()->addIndex($installer->getTable('sample_news_author'), $setup->getIdxName($installer->getTable('sample_news_author'), ['name', 'photo'], AdapterInterface::INDEX_TYPE_FULLTEXT), ['name', 'biography', 'url_key', 'resume', 'country', 'meta_title', 'meta_keywords', 'meta_description'], AdapterInterface::INDEX_TYPE_FULLTEXT);
}
//Create Authors to Store table
if (!$installer->tableExists('sample_news_author_store')) {
$table = $installer->getConnection()->newTable($installer->getTable('sample_news_author_store'));
$table->addColumn('author_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Author ID')->addColumn('store_id', Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Store ID')->addIndex($installer->getIdxName('sample_news_author_store', ['store_id']), ['store_id'])->addForeignKey($installer->getFkName('sample_news_author_store', 'author_id', 'sample_news_author', 'author_id'), 'author_id', $installer->getTable('sample_news_author'), 'author_id', Table::ACTION_CASCADE)->addForeignKey($installer->getFkName('sample_news_author_store', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', Table::ACTION_CASCADE)->setComment('Author To Store Link Table');
$installer->getConnection()->createTable($table);
}
if (!$installer->tableExists('sample_news_author_product')) {
$table = $installer->getConnection()->newTable($installer->getTable('sample_news_author_product'));
$table->addColumn('author_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Author ID')->addColumn('product_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Product ID')->addColumn('position', Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '0'], 'Position')->addIndex($installer->getIdxName('sample_news_author_product', ['product_id']), ['product_id'])->addForeignKey($installer->getFkName('sample_news_author_product', 'author_id', 'sample_news_author', 'author_id'), 'author_id', $installer->getTable('sample_news_author'), 'author_id', Table::ACTION_CASCADE)->addForeignKey($installer->getFkName('sample_news_author_product', 'product_id', 'catalog_product_entity', 'entity_id'), 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', Table::ACTION_CASCADE)->addIndex($installer->getIdxName('sample_news_author_product', ['author_id', 'product_id'], AdapterInterface::INDEX_TYPE_UNIQUE), ['author_id', 'product_id'], ['type' => AdapterInterface::INDEX_TYPE_UNIQUE])->setComment('Author To product Link Table');
$installer->getConnection()->createTable($table);
}
if (!$installer->tableExists('sample_news_author_category')) {
$table = $installer->getConnection()->newTable($installer->getTable('sample_news_author_category'));
$table->addColumn('author_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Author ID')->addColumn('category_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Category ID')->addColumn('position', Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '0'], 'Position')->addIndex($installer->getIdxName('sample_news_author_category', ['category_id']), ['category_id'])->addForeignKey($installer->getFkName('sample_news_author_category', 'author_id', 'sample_news_author', 'author_id'), 'author_id', $installer->getTable('sample_news_author'), 'author_id', Table::ACTION_CASCADE)->addForeignKey($installer->getFkName('sample_news_author_category', 'category_id', 'catalog_category_entity', 'entity_id'), 'category_id', $installer->getTable('catalog_category_entity'), 'entity_id', Table::ACTION_CASCADE)->addIndex($installer->getIdxName('sample_news_author_category', ['author_id', 'category_id'], AdapterInterface::INDEX_TYPE_UNIQUE), ['author_id', 'category_id'], ['type' => AdapterInterface::INDEX_TYPE_UNIQUE])->setComment('Author To category Link Table');
$installer->getConnection()->createTable($table);
}
}
开发者ID:sz-bill,项目名称:Magento2.x,代码行数:31,代码来源:InstallSchema.php
示例6: install
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
/**
* update columns created_at and updated_at in sales entities tables
*/
$tables = ['sales_order', 'quote'];
/** @var \Magento\Framework\DB\Adapter\AdapterInterface $connection */
$connection = $installer->getConnection();
foreach ($tables as $table) {
$columns = $connection->describeTable($installer->getTable($table));
if (!isset($columns['customer_lastnamekana'])) {
$setup->getConnection()->addColumn($table, 'customer_lastnamekana', ['type' => Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Customer Lastname Kana']);
}
if (!isset($columns['customer_firstnamekana'])) {
$setup->getConnection()->addColumn($table, 'customer_firstnamekana', ['type' => Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Customer Firstname Kana']);
}
}
$tables = ['sales_order_address', 'quote_address'];
foreach ($tables as $table) {
$columns = $connection->describeTable($installer->getTable($table));
if (!isset($columns['lastnamekana'])) {
$setup->getConnection()->addColumn($table, 'lastnamekana', ['type' => Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Customer Lastname Kana']);
}
if (!isset($columns['firstnamekana'])) {
$setup->getConnection()->addColumn($table, 'firstnamekana', ['type' => Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Customer Firstname Kana']);
}
}
}
开发者ID:magento-japan,项目名称:m2-jplocalize,代码行数:35,代码来源:InstallSchema.php
示例7: install
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$tableName = 'jcowie_featuretoggle';
$table = $setup->getConnection()->newTable($tableName);
$table->addColumn('featuretoggle_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'identity' => true, 'primary' => true])->addColumn('name', Table::TYPE_TEXT, 255, ['nullable' => false])->addColumn('status', Table::TYPE_TEXT, 255, ['nullable' => false]);
$setup->getConnection()->createTable($table);
}
开发者ID:jamescowie,项目名称:Magento2-FeatureToggles,代码行数:7,代码来源:InstallSchema.php
示例8: upgrade
/**
* {@inheritdoc}
*/
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '2.7.0', '<')) {
$setup->getConnection()->addColumn($setup->getTable('barbanet_samplemodule'), 'description', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'nullable' => false, 'comment' => 'Row description']);
}
$setup->endSetup();
}
开发者ID:barbanet,项目名称:magento2-samplemodule,代码行数:11,代码来源:UpgradeSchema.php
示例9: install
/**
* Installs DB schema for BuyerReview module
*
* @param SchemaSetupInterface $setup
* @param ModuleContextInterface $context
* @return void
*/
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
/* Add index on product_id field in sales_order_item table */
$installer->getConnection()->addIndex($installer->getTable('sales_order_item'), $setup->getIdxName($installer->getTable('sales_order_item'), ['product_id']), ['product_id']);
$installer->endSetup();
}
开发者ID:ytorbyk,项目名称:magento2-buyer-review,代码行数:15,代码来源:InstallSchema.php
示例10: upgrade
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '1.0.1') < 0) {
$this->createMailMainTable($setup);
}
$setup->endSetup();
}
开发者ID:shockwavemk,项目名称:magento2-module-mail,代码行数:8,代码来源:UpgradeSchema.php
示例11: install
/**
* @inheritdoc
*/
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$this->_context = $context;
$setup->startSetup();
/* perform module specific operations */
$this->_setup();
$setup->endSetup();
}
开发者ID:praxigento,项目名称:mobi_mod_mage2_core,代码行数:11,代码来源:Base.php
示例12: upgrade
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '1.1.2', '<')) {
$this->createTables($setup);
}
$setup->endSetup();
}
开发者ID:LoginRadius,项目名称:magento-identity-extension,代码行数:8,代码来源:UpgradeSchema.php
示例13: upgrade
/**
* {@inheritdoc}
*/
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$connection = $setup->getConnection();
if (version_compare($context->getVersion(), '2.0.1', '<')) {
$column = ['type' => Table::TYPE_SMALLINT, 'length' => 6, 'nullable' => false, 'comment' => 'Applied mode', 'default' => '0'];
$connection->addColumn($setup->getTable('checkout_agreement'), 'mode', $column);
}
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:11,代码来源:UpgradeSchema.php
示例14: install
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$setup->startSetup();
$table = $installer->getConnection()->newTable($installer->getTable('genmato_multistoresearchfields_attribute_search_store'))->addColumn('attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false], 'Attribute ID')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Store ID')->addIndex($installer->getIdxName('genmato_multistoresearchfields_attribute_search_store', ['store_id']), ['store_id'])->addForeignKey($installer->getFkName('genmato_multistoresearchfields_attribute_search_store', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($installer->getFkName('genmato_multistoresearchfields_attribute_search_store', 'attribute_id', 'eav_attribute', 'attribute_id'), 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Attribute Advanced Search Store');
$installer->getConnection()->createTable($table);
$installer->endSetup();
}
开发者ID:Genmato,项目名称:M2_MultistoreSearchFields,代码行数:8,代码来源:InstallSchema.php
示例15: upgrade
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$connection = $installer->getConnection();
if (version_compare($context->getVersion(), '2.0.1') < 0) {
$connection->dropIndex($setup->getTable('search_query'), $installer->getIdxName('search_query', ['query_text', 'store_id']));
$connection->addIndex($setup->getTable('search_query'), $installer->getIdxName('search_query', ['query_text', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['query_text', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE);
}
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:UpgradeSchema.php
示例16: appendDecimalDisplayConfiguration
/**
* Append decimal display related columns to attribute table
*
* @param \Magento\Framework\Setup\SchemaSetupInterface $setup The setup instance
*/
private function appendDecimalDisplayConfiguration(SchemaSetupInterface $setup)
{
$connection = $setup->getConnection();
$table = $setup->getTable('catalog_eav_attribute');
// Append a column 'display_pattern' into the db.
$connection->addColumn($table, 'display_pattern', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'nullable' => true, 'default' => null, 'length' => 10, 'comment' => 'The pattern to display facet values']);
// Append a column 'display_precision' into the db.
$connection->addColumn($table, 'display_precision', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 'nullable' => true, 'default' => 0, 'comment' => 'Attribute decimal precision for display']);
}
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:14,代码来源:UpgradeSchema.php
示例17: removeSubProductDiscounts
/**
* Remove Sub Product Discounts
* @param SchemaSetupInterface $setup
* @return void
*/
private function removeSubProductDiscounts(SchemaSetupInterface $setup)
{
$connection = $setup->getConnection();
$data = ['catalogrule' => ['sub_is_enable', 'sub_simple_action', 'sub_discount_amount'], 'catalogrule_product' => ['sub_simple_action', 'sub_discount_amount']];
foreach ($data as $table => $fields) {
foreach ($fields as $field) {
$connection->dropColumn($setup->getTable($table), $field);
}
}
}
开发者ID:Doability,项目名称:magento2dev,代码行数:15,代码来源:UpgradeSchema.php
|
请发表评论