本文整理汇总了PHP中Magento\Framework\Setup\ModuleContextInterface类的典型用法代码示例。如果您正苦于以下问题:PHP ModuleContextInterface类的具体用法?PHP ModuleContextInterface怎么用?PHP ModuleContextInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModuleContextInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: upgrade
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$setup->startSetup();
$version = $context->getVersion();
$connection = $setup->getConnection();
if (version_compare($version, '2.0.1') < 0) {
foreach (['magefan_blog_post_relatedpost', 'magefan_blog_post_relatedproduct'] as $tableName) {
// Get module table
$tableName = $setup->getTable($tableName);
// Check if the table already exists
if ($connection->isTableExists($tableName) == true) {
$columns = ['position' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 'nullable' => false, 'comment' => 'Position']];
foreach ($columns as $name => $definition) {
$connection->addColumn($tableName, $name, $definition);
}
}
}
$connection->addColumn($setup->getTable('magefan_blog_post'), 'featured_img', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'nullable' => true, 'comment' => 'Thumbnail Image']);
}
if (version_compare($version, '2.2.0') < 0) {
/* Add author field to posts tabel */
$connection->addColumn($setup->getTable('magefan_blog_post'), 'author_id', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 'nullable' => true, 'comment' => 'Author ID']);
$connection->addIndex($setup->getTable('magefan_blog_post'), $setup->getIdxName($setup->getTable('magefan_blog_post'), ['author_id']), ['author_id']);
}
if (version_compare($version, '2.2.5') < 0) {
/* Add layout field to posts and category tabels */
foreach (['magefan_blog_post', 'magefan_blog_category'] as $table) {
$table = $setup->getTable($table);
$connection->addColumn($setup->getTable($table), 'page_layout', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'nullable' => true, 'comment' => 'Post Layout']);
$connection->addColumn($setup->getTable($table), 'layout_update_xml', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => '64k', 'nullable' => true, 'comment' => 'Post Layout Update Content']);
$connection->addColumn($setup->getTable($table), 'custom_theme', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 100, 'nullable' => true, 'comment' => 'Post Custom Theme']);
$connection->addColumn($setup->getTable($table), 'custom_layout', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'nullable' => true, 'comment' => 'Post Custom Template']);
$connection->addColumn($setup->getTable($table), 'custom_layout_update_xml', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => '64k', 'nullable' => true, 'comment' => 'Post Custom Layout Update Content']);
$connection->addColumn($setup->getTable($table), 'custom_theme_from', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DATE, 'nullable' => true, 'comment' => 'Post Custom Theme Active From Date']);
$connection->addColumn($setup->getTable($table), 'custom_theme_to', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DATE, 'nullable' => true, 'comment' => 'Post Custom Theme Active To Date']);
}
}
if (version_compare($version, '2.3.0') < 0) {
/* Add meta title field to posts tabel */
$connection->addColumn($setup->getTable('magefan_blog_post'), 'meta_title', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'nullable' => true, 'comment' => 'Post Meta Title', 'after' => 'title']);
/* Add og tags fields to post tabel */
foreach (['type', 'img', 'description', 'title'] as $type) {
$connection->addColumn($setup->getTable('magefan_blog_post'), 'og_' . $type, ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'nullable' => true, 'comment' => 'Post OG ' . ucfirst($type), 'after' => 'identifier']);
}
/* Add meta title field to category tabel */
$connection->addColumn($setup->getTable('magefan_blog_category'), 'meta_title', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'nullable' => true, 'comment' => 'Category Meta Title', 'after' => 'title']);
/**
* Create table 'magefan_blog_tag'
*/
$table = $setup->getConnection()->newTable($setup->getTable('magefan_blog_tag'))->addColumn('tag_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Tag ID')->addColumn('title', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => true], 'Tag Title')->addColumn('identifier', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 100, ['nullable' => true, 'default' => null], 'Tag String Identifier')->addIndex($setup->getIdxName('magefan_blog_tag', ['identifier']), ['identifier'])->setComment('Magefan Blog Tag Table');
$setup->getConnection()->createTable($table);
/**
* Create table 'magefan_blog_post_tag'
*/
$table = $setup->getConnection()->newTable($setup->getTable('magefan_blog_post_tag'))->addColumn('post_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false, 'primary' => true], 'Post ID')->addColumn('tag_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false, 'primary' => true], 'Tag ID')->addIndex($setup->getIdxName('magefan_blog_post_tag', ['tag_id']), ['tag_id'])->addForeignKey($setup->getFkName('magefan_blog_post_tag', 'post_id', 'magefan_blog_post', 'post_id'), 'post_id', $setup->getTable('magefan_blog_post'), 'post_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName('magefan_blog_post_tag', 'tag_id', 'magefan_blog_tag', 'tag_id'), 'tag_id', $setup->getTable('magefan_blog_tag'), 'tag_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Magefan Blog Post To Category Linkage Table');
$setup->getConnection()->createTable($table);
}
$setup->endSetup();
}
开发者ID:magefan,项目名称:module-blog,代码行数:64,代码来源:UpgradeSchema.php
示例2: upgrade
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '2.0.1') < 0) {
/** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
$entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
$attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId);
$attributeGroup = $categorySetup->getAttributeGroup($entityTypeId, $attributeSetId, 'Images', 'attribute_group_name');
if (isset($attributeGroup['attribute_group_name']) && $attributeGroup['attribute_group_name'] == 'Images') {
// update General Group
$categorySetup->updateAttributeGroup($entityTypeId, $attributeSetId, $attributeGroup['attribute_group_id'], 'attribute_group_name', 'Images and Videos');
}
}
if ($context->getVersion() && version_compare($context->getVersion(), '2.0.1') < 0) {
$select = $setup->getConnection()->select()->from($setup->getTable('catalog_product_entity_group_price'), ['entity_id', 'all_groups', 'customer_group_id', new \Zend_Db_Expr('1'), 'value', 'website_id']);
$select = $setup->getConnection()->insertFromSelect($select, $setup->getTable('catalog_product_entity_tier_price'), ['entity_id', 'all_groups', 'customer_group_id', 'qty', 'value', 'website_id']);
$setup->getConnection()->query($select);
$categorySetupManager = $this->categorySetupFactory->create();
$categorySetupManager->removeAttribute(\Magento\Catalog\Model\Product::ENTITY, 'group_price');
}
if (version_compare($context->getVersion(), '2.0.2') < 0) {
// set new resource model paths
/** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
$categorySetup->updateEntityType(\Magento\Catalog\Model\Category::ENTITY, 'entity_model', 'Magento\\Catalog\\Model\\ResourceModel\\Category');
$categorySetup->updateEntityType(\Magento\Catalog\Model\Category::ENTITY, 'attribute_model', 'Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute');
$categorySetup->updateEntityType(\Magento\Catalog\Model\Category::ENTITY, 'entity_attribute_collection', 'Magento\\Catalog\\Model\\ResourceModel\\Category\\Attribute\\Collection');
$categorySetup->updateAttribute(\Magento\Catalog\Model\Category::ENTITY, 'custom_design_from', 'attribute_model', 'Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute');
$categorySetup->updateEntityType(\Magento\Catalog\Model\Product::ENTITY, 'entity_model', 'Magento\\Catalog\\Model\\ResourceModel\\Product');
$categorySetup->updateEntityType(\Magento\Catalog\Model\Product::ENTITY, 'attribute_model', 'Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute');
$categorySetup->updateEntityType(\Magento\Catalog\Model\Product::ENTITY, 'entity_attribute_collection', 'Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\Collection');
}
$setup->endSetup();
}
开发者ID:CompassPointMedia,项目名称:magento2,代码行数:39,代码来源:UpgradeData.php
示例3: upgrade
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '1.1.2', '<')) {
// Get module table
$tableName = $setup->getTable('lr_addresses');
// Check if the table already exists
if ($setup->getConnection()->isTableExists($tableName) == true) {
// Declare data
$columns = ['country' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'nullable' => false, 'comment' => 'country name']];
$connection = $setup->getConnection();
foreach ($columns as $name => $definition) {
$connection->addColumn($tableName, $name, $definition);
}
}
// Get module table
$tableNameExtendedProfile = $setup->getTable('lr_extended_profile_data');
// Check if the table already exists
if ($setup->getConnection()->isTableExists($tableNameExtendedProfile) == true) {
// Declare data
$columnsAdd = ['no_of_login' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'nullable' => false, 'comment' => 'no of login']];
$connectionData = $setup->getConnection();
foreach ($columnsAdd as $name => $definition) {
$connectionData->addColumn($tableNameExtendedProfile, $name, $definition);
}
}
}
$setup->endSetup();
}
开发者ID:LoginRadius,项目名称:magento-identity-extension,代码行数:29,代码来源:UpgradeSchema.php
示例4: upgrade
/**
* {@inheritdoc}
*/
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
$connection = $setup->getConnection();
if (version_compare($context->getVersion(), '1.1.0', '<')) {
//remove quote table
$connection->dropTable($setup->getTable('email_quote'));
}
if (version_compare($context->getVersion(), '2.0.6', '<')) {
//modify email_campaign table
$campaignTable = $setup->getTable('email_campaign');
//add columns
$connection->addColumn($campaignTable, 'send_id', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'nullable' => false, 'default' => '', 'comment' => 'Campaign Send Id']);
$connection->addColumn($campaignTable, 'send_status', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'nullable' => false, 'default' => 0, 'comment' => 'Send Status']);
if ($connection->tableColumnExists($campaignTable, 'is_sent')) {
//update table with historical send values
$select = $connection->select();
//join
$select->joinLeft(['oc' => $campaignTable], "oc.id = nc.id", ['send_status' => new \Zend_Db_Expr(\Dotdigitalgroup\Email\Model\Campaign::SENT)])->where('oc.is_sent =?', 1);
//update query from select
$updateSql = $select->crossUpdateFromSelect(['nc' => $campaignTable]);
//run query
$connection->query($updateSql);
//remove column
$connection->dropColumn($campaignTable, 'is_sent');
}
//add index
$connection->addIndex($campaignTable, $setup->getIdxName($campaignTable, ['send_status']), ['send_status']);
}
if (version_compare($context->getVersion(), '2.1.0', '<')) {
$couponTable = $setup->getTable('salesrule_coupon');
$connection->addColumn($couponTable, 'generated_by_dotmailer', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'nullable' => true, 'default' => null, 'comment' => '1 = Generated by dotmailer']);
}
$setup->endSetup();
}
开发者ID:dotmailer,项目名称:dotmailer-magento2-extension,代码行数:38,代码来源:UpgradeSchema.php
示例5: upgrade
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
if (version_compare($context->getVersion(), '1.0.1', '<')) {
/**
* update cms page sample
*/
$pageContent = <<<EOD
test update
EOD;
$cmsPage = $this->createPage()->load('test-cms-page', 'identifier');
if (!$cmsPage->getId()) {
$cmsPageContent = ['title' => 'test update', 'content_heading' => 'test', 'page_layout' => '1column', 'identifier' => 'test-cms-page', 'content' => $pageContent, 'is_active' => 1, 'stores' => [0], 'sort_order' => 0];
$this->createPage()->setData($cmsPageContent)->save();
} else {
$cmsPage->setContent($pageContent)->save();
}
/**
* update cms block sample
*/
$cmsBlockContent = <<<EOD
cms block sample update
EOD;
$cmsBlock = $this->createBlock()->load('test_cms_block', 'identifier');
if (!$cmsPage->getId()) {
$cmsBlock = ['title' => 'test cms block update', 'identifier' => 'test_cms_block', 'content' => $cmsBlockContent, 'is_active' => 1, 'stores' => 0];
$this->createBlock()->setData($cmsBlock)->save();
} else {
$cmsBlock->setContent($cmsBlockContent)->save();
}
}
}
开发者ID:yuliantoadi,项目名称:magento2-packages,代码行数:35,代码来源:UpgradeData-sample.php
示例6: upgrade
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '2.0.1', '<')) {
/**
* install vat exempt tax class
*/
$data = [['class_name' => 'Vatexempt Class', 'class_type' => \Magento\Tax\Model\ClassModel::TAX_CLASS_TYPE_PRODUCT]];
foreach ($data as $row) {
$setup->getConnection()->insertForce($setup->getTable('tax_class'), $row);
}
/**
* install vat exempt tax rate
*/
$data = [['tax_country_id' => 'US', 'tax_region_id' => '*', 'tax_postcode' => '*', 'code' => 'Vat Exempt', 'rate' => '0.00']];
foreach ($data as $row) {
$setup->getConnection()->insertForce($setup->getTable('tax_calculation_rate'), $row);
}
/**
* install vat exempt tax rule
*/
$this->_executor->exec($this->_installer);
}
$setup->endSetup();
}
开发者ID:Doability,项目名称:magento2dev,代码行数:25,代码来源:UpgradeData.php
示例7: upgrade
/**
* Upgrades DB schema for a module
*
* @param SchemaSetupInterface $setup
* @param ModuleContextInterface $context
* @return void
*/
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
// Action to do if module version is less than 1.0.0.0
if (version_compare($context->getVersion(), '1.0.0.0') < 0) {
#Create table 'maxime_jobs'
$tableName = $installer->getTable('maxime_job');
$tableComment = 'Job management on Magento 2';
$columns = array('entity_id' => array('type' => Table::TYPE_INTEGER, 'size' => null, 'options' => array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), 'comment' => 'Job Id'), 'title' => array('type' => Table::TYPE_TEXT, 'size' => 255, 'options' => array('nullable' => false, 'default' => ''), 'comment' => 'Job Title'), 'type' => array('type' => Table::TYPE_TEXT, 'size' => 255, 'options' => array('nullable' => false, 'default' => ''), 'comment' => 'Job Type (CDI, CDD...)'), 'location' => array('type' => Table::TYPE_TEXT, 'size' => 255, 'options' => array('nullable' => false, 'default' => ''), 'comment' => 'Job Location'), 'date' => array('type' => Table::TYPE_DATE, 'size' => null, 'options' => array('nullable' => false), 'comment' => 'Job date begin'), 'status' => array('type' => Table::TYPE_BOOLEAN, 'size' => null, 'options' => array('nullable' => false, 'default' => 0), 'comment' => 'Job status'), 'description' => array('type' => Table::TYPE_TEXT, 'size' => 2048, 'options' => array('nullable' => false, 'default' => ''), 'comment' => 'Job description'), 'department_id' => array('type' => Table::TYPE_INTEGER, 'size' => null, 'options' => array('unsigned' => true, 'nullable' => false), 'comment' => 'Department linked to the job'));
$indexes = array('title');
$foreignKeys = array('department_id' => array('ref_table' => 'maxime_department', 'ref_column' => 'entity_id', 'on_delete' => Table::ACTION_CASCADE));
#We can use the parameters above to create our table
// Table creation
$table = $installer->getConnection()->newTable($tableName);
// Columns creation
foreach ($columns as $name => $values) {
$table->addColumn($name, $values['type'], $values['size'], $values['options'], $values['comment']);
}
// Indexes creation
foreach ($indexes as $index) {
$table->addIndex($installer->getIdxName($tableName, array($index)), array($index));
}
// Foreign keys creation
foreach ($foreignKeys as $column => $foreignKey) {
$table->addForeignKey($installer->getFkName($tableName, $column, $foreignKey['ref_table'], $foreignKey['ref_column']), $column, $foreignKey['ref_table'], $foreignKey['ref_column'], $foreignKey['on_delete']);
}
// Table comment
$table->setComment($tableComment);
// Execute SQL to create the table
$installer->getConnection()->createTable($table);
}
$installer->endSetup();
}
开发者ID:sz-bill,项目名称:Magento2.x,代码行数:41,代码来源:UpgradeSchema.php
示例8: upgrade
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '2.0.0.1') < 0) {
$installer = $setup;
$connection = $installer->getConnection();
$tableNames = ['customer_address_entity_varchar', 'customer_address_entity_datetime', 'customer_address_entity_decimal', 'customer_address_entity_int', 'customer_address_entity_text', 'customer_entity_varchar', 'customer_entity_datetime', 'customer_entity_decimal', 'customer_entity_int', 'customer_entity_text'];
foreach ($tableNames as $table) {
$connection->dropForeignKey($installer->getTable($table), $installer->getFkName($table, 'entity_type_id', 'eav_entity_type', 'entity_type_id'));
$connection->dropIndex($installer->getTable($table), $installer->getIdxName($installer->getTable($table), ['entity_type_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX));
$connection->dropColumn($installer->getTable($table), 'entity_type_id');
}
$connection->dropColumn($installer->getTable('customer_address_entity'), 'entity_type_id');
$connection->dropColumn($installer->getTable('customer_address_entity'), 'attribute_set_id');
$connection->dropIndex($installer->getTable('customer_entity'), $installer->getIdxName('customer_entity', ['entity_type_id']));
$connection->dropColumn($installer->getTable('customer_entity'), 'entity_type_id');
$connection->dropColumn($installer->getTable('customer_entity'), 'attribute_set_id');
}
if (version_compare($context->getVersion(), '2.0.0.2') < 0) {
/**
* Update 'customer_visitor' table.
*/
$setup->getConnection()->addColumn($setup->getTable('customer_visitor'), 'customer_id', ['type' => Table::TYPE_INTEGER, 'after' => 'visitor_id', 'comment' => 'Customer ID']);
$setup->getConnection()->addIndex($setup->getTable('customer_visitor'), $setup->getIdxName($setup->getTable('customer_visitor'), ['customer_id']), 'customer_id');
/**
* Create 'customer_log' table.
*/
$table = $setup->getConnection()->newTable($setup->getTable('customer_log'))->addColumn('log_id', Table::TYPE_INTEGER, null, ['nullable' => false, 'identity' => true, 'primary' => true], 'Log ID')->addColumn('customer_id', Table::TYPE_INTEGER, null, ['nullable' => false], 'Customer ID')->addColumn('last_login_at', Table::TYPE_TIMESTAMP, null, ['nullable' => true, 'default' => null], 'Last Login Time')->addColumn('last_logout_at', Table::TYPE_TIMESTAMP, null, ['nullable' => true, 'default' => null], 'Last Logout Time')->addIndex($setup->getIdxName($setup->getTable('customer_log'), ['customer_id'], AdapterInterface::INDEX_TYPE_UNIQUE), ['customer_id'], ['type' => AdapterInterface::INDEX_TYPE_UNIQUE])->setComment('Customer Log Table');
$setup->getConnection()->createTable($table);
}
$setup->endSetup();
}
开发者ID:niranjanssiet,项目名称:magento2,代码行数:36,代码来源:UpgradeSchema.php
示例9: 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);
}
if (version_compare($context->getVersion(), '2.0.2') < 0) {
/**
* Create table 'search_synonyms'
*/
$table = $connection->newTable($installer->getTable('search_synonyms'))->addColumn('group_id', \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Synonyms Group Id')->addColumn('synonyms', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 65535, ['nullable' => false], 'list of synonyms making up this group')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Store Id - identifies the store view these synonyms belong to')->addIndex($setup->getIdxName($installer->getTable('search_synonyms'), ['synonyms'], AdapterInterface::INDEX_TYPE_FULLTEXT), ['synonyms'], ['type' => AdapterInterface::INDEX_TYPE_FULLTEXT])->addIndex($installer->getIdxName('search_synonyms', 'store_id'), ['store_id'], ['type' => AdapterInterface::INDEX_TYPE_INDEX])->addForeignKey($installer->getFkName('search_synonyms', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('table storing various synonyms groups per store view');
$connection->createTable($table);
}
if (version_compare($context->getVersion(), '2.0.3') < 0) {
// Drop and recreate 'search_synonyms' table
$connection->dropTable($installer->getTable('search_synonyms'));
$table = $connection->newTable($installer->getTable('search_synonyms'))->addColumn('group_id', \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Synonyms Group Id')->addColumn('synonyms', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 65535, ['nullable' => false], 'list of synonyms making up this group')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Store Id - identifies the store view these synonyms belong to')->addColumn('website_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Website Id - identifies the website id these synonyms belong to')->addIndex($setup->getIdxName($installer->getTable('search_synonyms'), ['synonyms'], AdapterInterface::INDEX_TYPE_FULLTEXT), ['synonyms'], ['type' => AdapterInterface::INDEX_TYPE_FULLTEXT])->addIndex($installer->getIdxName('search_synonyms', 'store_id'), ['store_id'], ['type' => AdapterInterface::INDEX_TYPE_INDEX])->addIndex($installer->getIdxName('search_synonyms', 'website_id'), ['website_id'], ['type' => AdapterInterface::INDEX_TYPE_INDEX])->addForeignKey($installer->getFkName('search_synonyms', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($installer->getFkName('search_synonyms', 'website_id', 'store_website', 'website_id'), 'website_id', $installer->getTable('store_website'), 'website_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('table storing various synonyms groups');
$connection->createTable($table);
}
if (version_compare($context->getVersion(), '2.0.4') < 0) {
$connection->dropIndex($setup->getTable('search_query'), $installer->getIdxName('search_query', 'synonym_for'));
$connection->dropColumn($setup->getTable('search_query'), 'synonym_for');
}
}
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:30,代码来源:UpgradeSchema.php
示例10: upgrade
/**
* {@inheritdoc}
*/
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
if (version_compare($context->getVersion(), '2.0.0.1') < 0) {
$installer = $setup;
$installer->startSetup();
$connection = $installer->getConnection();
$connection->dropForeignKey($installer->getTable('catalog_product_entity'), 'FK_CAT_PRD_ENTT_ENTT_TYPE_ID_EAV_ENTT_TYPE_ENTT_TYPE_ID');
//Drop entity_type_id column for catalog product entities
$connection->dropColumn($installer->getTable('catalog_product_entity'), 'entity_type_id');
$connection->dropColumn($installer->getTable('catalog_product_entity_datetime'), 'entity_type_id');
$connection->dropColumn($installer->getTable('catalog_product_entity_decimal'), 'entity_type_id');
$connection->dropColumn($installer->getTable('catalog_product_entity_gallery'), 'entity_type_id');
$connection->dropColumn($installer->getTable('catalog_product_entity_int'), 'entity_type_id');
$connection->dropColumn($installer->getTable('catalog_product_entity_text'), 'entity_type_id');
$connection->dropColumn($installer->getTable('catalog_product_entity_varchar'), 'entity_type_id');
//Drop entity_type_id column for catalog category entities
$connection->dropColumn($installer->getTable('catalog_category_entity'), 'entity_type_id');
$connection->dropColumn($installer->getTable('catalog_category_entity_datetime'), 'entity_type_id');
$connection->dropColumn($installer->getTable('catalog_category_entity_decimal'), 'entity_type_id');
$connection->dropColumn($installer->getTable('catalog_category_entity_int'), 'entity_type_id');
$connection->dropColumn($installer->getTable('catalog_category_entity_text'), 'entity_type_id');
$connection->dropColumn($installer->getTable('catalog_category_entity_varchar'), 'entity_type_id');
$installer->endSetup();
}
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:28,代码来源:UpgradeSchema.php
示例11: upgrade
/**
* Upgrade the module data.
*
* @param ModuleDataSetupInterface $setup The setup interface
* @param ModuleContextInterface $context The module Context
*
* @return void
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '1.1.0', '<')) {
$this->updateVirtualCategoryRootTypeToInt($setup);
}
$setup->endSetup();
}
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:16,代码来源:UpgradeData.php
示例12: upgrade
/**
* {@inheritdoc}
*/
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '2.0.1', '<')) {
$setup->getConnection()->addIndex($setup->getTable('quote_id_mask'), $setup->getIdxName('quote_id_mask', ['masked_id']), ['masked_id']);
}
$setup->endSetup();
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:UpgradeSchema.php
示例13: 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
示例14: upgrade
/**
* {@inheritdoc}
*/
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '2.0.1', '<')) {
$this->removeSubProductDiscounts($setup);
}
$setup->endSetup();
}
开发者ID:Doability,项目名称:magento2dev,代码行数:11,代码来源:UpgradeSchema.php
示例15: upgrade
/**
* Installs DB schema for a module
*
* @param SchemaSetupInterface $setup Setup
* @param ModuleContextInterface $context Context
*
* @return void
*/
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '1.1.0', '<')) {
$this->appendDecimalDisplayConfiguration($setup);
}
$setup->endSetup();
}
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:16,代码来源:UpgradeSchema.php
示例16: upgrade
/**
* {@inheritdoc}
*/
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '2.0.1', '<')) {
$this->addDefaultValueForDiscountStep($setup);
}
$setup->endSetup();
}
开发者ID:Doability,项目名称:magento2dev,代码行数:11,代码来源:UpgradeSchema.php
示例17: 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
示例18: upgrade
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '1.0.1') < 0) {
$this->createMailDropboxUserTable($setup);
}
$setup->endSetup();
}
开发者ID:shockwave-design,项目名称:magento2-module-mail-storeage-dropbox,代码行数:8,代码来源:UpgradeSchema.php
示例19: 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
示例20: upgrade
/**
* @inheritdoc
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '2.0.1', '<')) {
$this->upgradeHash($setup);
}
$setup->endSetup();
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:UpgradeData.php
注:本文中的Magento\Framework\Setup\ModuleContextInterface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论