Пример #1
0
 /**
  * {@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();
 }
Пример #2
0
 /**
  * {@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();
 }
 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();
 }
 /**
  * {@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();
 }
    /**
     * {@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();
            }
        }
    }
Пример #6
0
 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();
 }
Пример #7
0
 /**
  * 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();
 }
Пример #8
0
 /**
  * {@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();
 }
 /**
  * {@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');
     }
 }
Пример #10
0
 /**
  * {@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();
     }
 }
Пример #11
0
 /**
  * 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();
 }
Пример #12
0
 /**
  * {@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();
 }
 /**
  * {@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();
 }
Пример #14
0
 /**
  * {@inheritdoc}
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1', '<')) {
         $this->removeSubProductDiscounts($setup);
     }
     $setup->endSetup();
 }
Пример #15
0
 /**
  * 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();
 }
Пример #16
0
 /**
  * {@inheritdoc}
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1', '<')) {
         $this->addDefaultValueForDiscountStep($setup);
     }
     $setup->endSetup();
 }
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '1.1.2', '<')) {
         $this->createTables($setup);
     }
     $setup->endSetup();
 }
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '1.0.1') < 0) {
         $this->createMailDropboxUserTable($setup);
     }
     $setup->endSetup();
 }
Пример #19
0
 /**
  * {@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);
     }
 }
Пример #20
0
 /**
  * @inheritdoc
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1', '<')) {
         $this->upgradeHash($setup);
     }
     $setup->endSetup();
 }
Пример #21
0
 /**
  * {@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);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     if (version_compare($context->getVersion(), '0.0.3') < 0) {
         $installer = $setup;
         $installer->startSetup();
         $installer->getConnection()->addColumn($installer->getTable('crud'), 'url_key', array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, 'nullable' => true, 'length' => '1k', 'comment' => 'Url Key'));
         $installer->endSetup();
     }
 }
Пример #23
0
 /**
  * {@inheritdoc}
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1', '<')) {
         $setup->getConnection()->changeColumn($setup->getTable(\Magento\Security\Setup\InstallSchema::ADMIN_SESSIONS_DB_TABLE_NAME), 'ip', 'ip', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 15, 'nullable' => false, 'comment' => 'Remote user IP']);
         $setup->getConnection()->changeColumn($setup->getTable(\Magento\Security\Setup\InstallSchema::PASSWORD_RESET_REQUEST_EVENT_DB_TABLE_NAME), 'ip', 'ip', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 15, 'nullable' => false, 'comment' => 'Remote user IP']);
     }
     $setup->endSetup();
 }
Пример #24
0
 /**
  * {@inheritdoc}
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1', '<')) {
         $this->addSupportVideoMediaAttributes($setup);
         $this->removeGroupPrice($setup);
     }
     $setup->endSetup();
 }
Пример #25
0
 /**
  * {@inheritdoc}
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '1.2.0', '<')) {
         $this->addTrackableTable($setup);
         $this->createMarketplacesRemoteOrderTable($setup);
     }
     $setup->endSetup();
 }
Пример #26
0
 /**
  * {@inheritdoc}
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '0.1.1', '<')) {
         $connection = $setup->getConnection();
         $column = ['type' => Table::TYPE_SMALLINT, 'length' => 6, 'nullable' => false, 'comment' => 'Is Visible', 'default' => '1'];
         $connection->addColumn($setup->getTable('genmato_demo'), 'is_visible', $column);
     }
     $setup->endSetup();
 }
Пример #27
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $installer = $setup;
     $connection = $installer->getConnection();
     if (version_compare($context->getVersion(), '2.0.1') < 0) {
         $connection->dropTable($installer->getTable('catalogsearch_fulltext'));
         $table = $connection->newTable($installer->getTable('catalogsearch_fulltext_index_default'))->addColumn('FTS_DOC_ID', Table::TYPE_BIGINT, null, ['unsigned' => true, 'nullable' => false, 'auto_increment' => true, 'primary' => true], 'Entity ID')->addColumn('product_id', Table::TYPE_INTEGER, 10, ['unsigned' => true, 'nullable' => false], 'Product ID')->addColumn('attribute_id', Table::TYPE_INTEGER, 10, ['unsigned' => true, 'nullable' => false])->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false], 'Store ID')->addColumn('data_index', Table::TYPE_TEXT, '4g', ['nullable' => true], 'Data index')->addIndex('FTI_CATALOGSEARCH_FULLTEXT_DATA_INDEX', ['data_index'], ['type' => AdapterInterface::INDEX_TYPE_FULLTEXT]);
         $connection->createTable($table);
     }
 }
Пример #28
0
 /**
  * {@inheritdoc}
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1', '<')) {
         $connection = $setup->getConnection();
         $select = $connection->select()->from($this->relationProcessor->getTable('catalog_product_link'), ['product_id', 'linked_product_id'])->where('link_type_id = ?', Link::LINK_TYPE_GROUPED);
         $connection->query($connection->insertFromSelect($select, $this->relationProcessor->getMainTable(), ['parent_id', 'child_id'], AdapterInterface::INSERT_IGNORE));
     }
     $setup->endSetup();
 }
Пример #29
0
 /**
  * {@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'));
     }
     $setup->endSetup();
 }
 /**
  * Upgrades data for a module
  *
  * @param ModuleDataSetupInterface $setup
  * @param ModuleContextInterface $context
  * @return void
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $dbVersion = $context->getVersion();
     if (version_compare($dbVersion, '0.1.0', '<')) {
         /** @var CustomerSetup $customerSetup */
         $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
         $customerSetup->addAttribute(self::CUSTOMER_EAV_ENTITY_TYPE, self::OPENPAY_CUSTOMER_ID_CUSTOM_ATTRIBUTE, ['label' => 'Openpay Customer ID', 'required' => 0, 'system' => 0, 'position' => 100]);
         $customerSetup->getEavConfig()->getAttribute('customer', self::OPENPAY_CUSTOMER_ID_CUSTOM_ATTRIBUTE)->setData('used_in_forms', ['adminhtml_customer'])->save();
     }
 }