Пример #1
3
 /**
  * {@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);
     }
 }
Пример #2
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();
 }
 /**
  * {@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');
     }
 }
Пример #4
0
 /**
  * {@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();
 }
Пример #5
0
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $entityTypeModel = $this->_entityTypeModel;
     $catalogAttributeModel = $this->_catalogAttribute;
     $installer = $this->_eavSetup;
     $setup->startSetup();
     /**
      * Drop table if exists
      */
     $setup->getConnection()->dropTable($setup->getTable('ves_brand_group'));
     $setup->getConnection()->dropTable($setup->getTable('ves_brand'));
     $setup->getConnection()->dropTable($setup->getTable('ves_brand_store'));
     /**
      * Create table 'ves_brand_group'
      */
     $table = $setup->getConnection()->newTable($setup->getTable('ves_brand_group'))->addColumn('group_id', Table::TYPE_INTEGER, 11, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Group ID')->addColumn('name', Table::TYPE_TEXT, 255, ['nullable' => false], 'Group Name')->addColumn('url_key', Table::TYPE_TEXT, 255, ['nullable' => false], 'Group Url Key')->addColumn('position', Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '0'], 'Position')->addColumn('status', Table::TYPE_SMALLINT, null, ['nullable' => false, 'default' => '1'], 'Status')->addColumn('shown_in_sidebar', Table::TYPE_SMALLINT, null, ['nullable' => false, 'default' => '1'], 'Show In Sidebar')->setComment('Brand Group');
     $setup->getConnection()->createTable($table);
     /**
      * Create table 'ves_brand'
      */
     $table = $setup->getConnection()->newTable($setup->getTable('ves_brand'))->addColumn('brand_id', Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Brand ID')->addColumn('name', Table::TYPE_TEXT, 255, ['nullable' => false], 'Brand Name')->addColumn('url_key', Table::TYPE_TEXT, 255, ['nullable' => false], 'Brand Url Key')->addColumn('description', Table::TYPE_TEXT, '64k', ['nullable' => false], 'Brand Description')->addColumn('group_id', Table::TYPE_INTEGER, 11, ['unsigned' => true, 'nullable' => false], 'Group ID')->addColumn('image', Table::TYPE_TEXT, 255, ['nullable' => false], 'Brand Image')->addColumn('thumbnail', Table::TYPE_TEXT, 255, ['nullable' => false], 'Brand Thumbnail')->addColumn('page_title', Table::TYPE_TEXT, 255, ['nullable' => false], 'Brand Page Title')->addColumn('meta_keywords', Table::TYPE_TEXT, '64k', ['nullable' => false], 'Meta Keywords')->addColumn('meta_description', Table::TYPE_TEXT, '64k', ['nullable' => false], 'Meta Description')->addColumn('creation_time', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, [], 'Brand Creation Time')->addColumn('update_time', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, [], 'Brand Modification Time')->addColumn('page_layout', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => true], 'Page Layout')->addColumn('layout_update_xml', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', ['nullable' => true], 'Page Layout Update Content')->addColumn('status', Table::TYPE_SMALLINT, null, ['nullable' => false, 'default' => '1'], 'Status')->addColumn('position', Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '0'], 'Position')->addIndex($setup->getIdxName('ves_brand', ['group_id']), ['group_id'])->addForeignKey($setup->getFkName('ves_brand', 'group_id', 'ves_brand', 'group_id'), 'group_id', $setup->getTable('ves_brand_group'), 'group_id', Table::ACTION_CASCADE)->setComment('Brand Information');
     $setup->getConnection()->createTable($table);
     /**
      * Create table 'ves_brand_store'
      */
     $table = $setup->getConnection()->newTable($setup->getTable('ves_brand_store'))->addColumn('brand_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Brand Id')->addColumn('store_id', Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Store Id')->addIndex($setup->getIdxName('ves_brand_store', ['store_id']), ['store_id'])->addForeignKey($setup->getFkName('ves_brand_store', 'brand_id', 'ves_brand', 'brand_id'), 'brand_id', $setup->getTable('ves_brand'), 'brand_id', Table::ACTION_CASCADE)->addForeignKey($setup->getFkName('ves_brand_store', 'store_id', 'store', 'store_id'), 'store_id', $setup->getTable('store'), 'store_id', Table::ACTION_CASCADE)->setComment('Brand Store');
     $setup->getConnection()->createTable($table);
     $installer->removeAttribute($entityTypeModel->loadByCode('catalog_product')->getData('entity_type_id'), 'product_brand');
     $data = array('group' => 'General', 'type' => 'varchar', 'input' => 'select', 'default' => 1, 'label' => 'Product Brand', 'backend' => 'Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\ArrayBackend', 'frontend' => '', 'source' => 'Ves\\Brand\\Model\\Brandlist', 'visible' => 1, 'required' => 1, 'user_defined' => 1, 'used_for_price_rules' => 1, 'position' => 2, 'unique' => 0, 'default' => '', 'sort_order' => 100, 'is_global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE, 'is_required' => 0, 'is_configurable' => 1, 'is_searchable' => 0, 'is_visible_in_advanced_search' => 0, 'is_comparable' => 0, 'is_filterable' => 0, 'is_filterable_in_search' => 1, 'is_used_for_promo_rules' => 1, 'is_html_allowed_on_front' => 0, 'is_visible_on_front' => 1, 'used_in_product_listing' => 1, 'used_for_sort_by' => 0);
     $installer->addAttribute($entityTypeModel->loadByCode('catalog_product')->getData('entity_type_id'), 'product_brand', $data);
     $brandIds = $catalogAttributeModel->loadByCode('catalog_product', 'product_brand');
     $brandIds->addData($data)->save();
     $setup->endSetup();
 }
Пример #6
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();
 }
Пример #7
0
 /**
  * @inheritdoc
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  * @throws \Zend_Db_Exception
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $table = $setup->startSetup()->getConnection()->newTable($setup->getTable(self::PAYMENT_TOKEN_TABLE))->addColumn(InstallSchema::ID_FILED_NAME, Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Entity Id')->addColumn('customer_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => true], 'Customer Id')->addColumn('public_hash', Table::TYPE_TEXT, 128, ['nullable' => false], 'Hash code for using on frontend')->addColumn('payment_method_code', Table::TYPE_TEXT, 128, ['nullable' => false], 'Payment method code')->addColumn('type', Table::TYPE_TEXT, 128, ['nullable' => false], 'Type')->addColumn('created_at', Table::TYPE_TIMESTAMP, null, ['nullable' => false, 'default' => Table::TIMESTAMP_INIT], 'Created At')->addColumn('expires_at', Table::TYPE_TIMESTAMP, null, ['nullable' => true], 'Expires At')->addColumn('gateway_token', Table::TYPE_TEXT, 255, ['nullable' => false], 'Gateway Token')->addColumn('details', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', ['nullable' => true], 'Details')->addColumn('is_active', Table::TYPE_BOOLEAN, null, ['nullable' => false, 'dafault' => true], 'Is active flag')->addColumn('is_visible', Table::TYPE_BOOLEAN, null, ['nullable' => false, 'dafault' => true], 'Is visible flag')->addIndex($setup->getIdxName('vault_payment_token_unique_index', ['payment_method_code', 'customer_id', 'gateway_token'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['payment_method_code', 'customer_id', 'gateway_token'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addIndex($setup->getIdxName('vault_payment_token_hash_unique_index', ['public_hash'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['public_hash'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addForeignKey($setup->getFkName($setup->getTable(self::PAYMENT_TOKEN_TABLE), 'customer_id', $setup->getTable('customer_entity'), 'entity_id'), 'customer_id', $setup->getTable('customer_entity'), 'entity_id', Table::ACTION_CASCADE)->setComment('Vault tokens of payment');
     $setup->getConnection()->createTable($table);
     $table = $setup->startSetup()->getConnection()->newTable($setup->getTable(self::ORDER_PAYMENT_TO_PAYMENT_TOKEN_TABLE))->addColumn('order_payment_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Order payment Id')->addColumn('payment_token_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Payment token Id')->addForeignKey($setup->getFkName($setup->getTable(self::ORDER_PAYMENT_TO_PAYMENT_TOKEN_TABLE), 'order_payment_id', $setup->getTable('sales_order_payment'), 'entity_id'), 'order_payment_id', $setup->getTable('sales_order_payment'), 'entity_id', Table::ACTION_CASCADE)->addForeignKey($setup->getFkName($setup->getTable(self::ORDER_PAYMENT_TO_PAYMENT_TOKEN_TABLE), 'payment_token_id', $setup->getTable(self::PAYMENT_TOKEN_TABLE), 'entity_id'), 'payment_token_id', $setup->getTable(self::PAYMENT_TOKEN_TABLE), 'entity_id', Table::ACTION_CASCADE)->setComment('Order payments to vault token');
     $setup->getConnection()->createTable($table);
     $setup->endSetup();
 }
Пример #8
0
 protected function createMarketplacesRemoteOrderTable(SchemaSetupInterface $setup)
 {
     $tableName = 'springbot_marketplaces_remote_order';
     // Check if the table already exists
     if ($setup->getConnection()->isTableExists($tableName) == false) {
         $table = $setup->getConnection()->newTable($tableName)->addColumn('id', Table::TYPE_INTEGER, 11, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'ID')->addColumn('order_id', Table::TYPE_INTEGER, 11, ['nullable' => false], 'Customer Order ID')->addColumn('increment_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 32, [], 'Magento Order Increment Id')->addColumn('remote_order_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 32, [], 'Order ID in Remote Marketplace')->addColumn('marketplace_type', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 32, [], 'Marketplace of Origin')->setComment('Springbot join table for remote orders')->addIndex($setup->getIdxName($tableName, ['remote_order_id']), ['remote_order_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addIndex($setup->getIdxName($tableName, ['increment_id']), ['increment_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE]);
         $setup->getConnection()->createTable($table);
     }
 }
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     /**
      * Create table 'tudock_helloworld'
      */
     $table = $setup->getConnection()->newTable($setup->getTable('tudock_helloworld'))->addColumn('id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'default' => '0', 'primary' => true], 'ID of text')->addColumn('product', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Product ID')->addColumn('text', Table::TYPE_TEXT, 255, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Text')->setComment('HelloWorld demo table')->addIndex($setup->getIdxName('tudock_helloworld', 'id', \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), 'id', ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addIndex($setup->getIdxName('tudock_helloworld', 'product'), 'product')->addForeignKey($setup->getFkName('tudock_helloworld', 'product', 'catalog_product_entity', 'entity_id'), 'product', $setup->getTable('catalog_product_entity'), 'entity_id', Table::ACTION_CASCADE);
     $setup->getConnection()->createTable($table);
     $setup->endSetup();
 }
Пример #10
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     /**
      * Create table 'weee_tax'
      */
     $table = $setup->getConnection()->newTable($setup->getTable('weee_tax'))->addColumn('value_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Value Id')->addColumn('website_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Website Id')->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Entity Id')->addColumn('country', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 2, ['nullable' => true], 'Country')->addColumn('value', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['nullable' => false, 'default' => '0.0000'], 'Value')->addColumn('state', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '0'], 'State')->addColumn('attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false], 'Attribute Id')->addIndex($setup->getIdxName('weee_tax', ['website_id']), ['website_id'])->addIndex($setup->getIdxName('weee_tax', ['entity_id']), ['entity_id'])->addIndex($setup->getIdxName('weee_tax', ['country']), ['country'])->addIndex($setup->getIdxName('weee_tax', ['attribute_id']), ['attribute_id'])->addForeignKey($setup->getFkName('weee_tax', 'country', 'directory_country', 'country_id'), 'country', $setup->getTable('directory_country'), 'country_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName('weee_tax', 'entity_id', 'catalog_product_entity', 'entity_id'), 'entity_id', $setup->getTable('catalog_product_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName('weee_tax', 'website_id', 'store_website', 'website_id'), 'website_id', $setup->getTable('store_website'), 'website_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName('weee_tax', 'attribute_id', 'eav_attribute', 'attribute_id'), 'attribute_id', $setup->getTable('eav_attribute'), 'attribute_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Weee Tax');
     $setup->getConnection()->createTable($table);
     $setup->endSetup();
 }
Пример #11
0
 /**
  * {@inheritdoc}
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $contextInterface)
 {
     $setup->startSetup();
     $swatchTable = $setup->getTable('eav_attribute_option_swatch');
     /** Creating the main_table 'eav_attribute_option_swatch' */
     $table = $setup->getConnection()->newTable($swatchTable)->addColumn('swatch_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Swatch ID')->addColumn('option_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => false, 'unsigned' => true, 'nullable' => false, 'primary' => false], 'Option ID')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['identity' => false, 'unsigned' => true, 'nullable' => false, 'primary' => false], 'Store ID')->addColumn('type', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['identity' => false, 'unsigned' => true, 'nullable' => false, 'primary' => false], 'Swatch type: 0 - text, 1 - visual color, 2 - visual image')->addColumn('value', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['identity' => false, 'unsigned' => false, 'nullable' => true, 'primary' => false], 'Swatch Value')->addIndex($setup->getIdxName($swatchTable, ['swatch_id']), ['swatch_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX])->addIndex($setup->getIdxName($swatchTable, ['store_id', 'option_id'], true), ['store_id', 'option_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addForeignKey($setup->getFkName($swatchTable, 'store_id', 'store', 'store_id'), 'store_id', $setup->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName($swatchTable, 'option_id', 'eav_attribute_option', 'option_id'), 'option_id', $setup->getTable('eav_attribute_option'), 'option_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Magento Swatches table');
     if (!$setup->getConnection()->tableColumnExists($setup->getTable('catalog_eav_attribute'), 'additional_data')) {
         $setup->getConnection()->addColumn($setup->getTable('catalog_eav_attribute'), 'additional_data', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'default' => null, 'nullable' => true, 'comment' => 'Additional swatch attributes data']);
     }
     $setup->getConnection()->createTable($table);
     $setup->endSetup();
 }
Пример #12
0
 /**
  * {@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();
 }
Пример #13
0
 /**
  * {@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);
     }
 }
 /**
  * {@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();
 }
Пример #15
0
 /**
  *
  * @param SchemaSetupInterface $setup
  * @return void
  */
 protected function createValueToEntityTable(SchemaSetupInterface $setup)
 {
     /**
      * Create table 'catalog_product_entity_media_gallery_value_to_entity'
      */
     $table = $setup->getConnection()->newTable($setup->getTable(Media::GALLERY_VALUE_TO_ENTITY_TABLE))->addColumn('value_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false], 'Value media Entry ID')->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false], 'Product entity ID')->addIndex($setup->getIdxName(Media::GALLERY_VALUE_TO_ENTITY_TABLE, ['value_id', 'entity_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['value_id', 'entity_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addForeignKey($setup->getFkName(Media::GALLERY_VALUE_TO_ENTITY_TABLE, 'value_id', Media::GALLERY_TABLE, 'value_id'), 'value_id', $setup->getTable(Media::GALLERY_TABLE), 'value_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName(Media::GALLERY_VALUE_TO_ENTITY_TABLE, 'entity_id', 'catalog_product_entity', 'entity_id'), 'entity_id', $setup->getTable('catalog_product_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Link Media value to Product entity table');
     $setup->getConnection()->createTable($table);
 }
Пример #16
0
 /**
  * Installs DB schema
  *
  * @param SchemaSetupInterface $setup
  * @param ModuleContextInterface $context
  * @return void
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $connection = $setup->getConnection();
     $connection->addColumn($setup->getTable('catalog_eav_attribute'), 'used_in_recommender', "smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Is Used In Product Listing'");
     $connection->addIndex($setup->getTable('catalog_eav_attribute'), $setup->getIdxName('catalog_eav_attribute', ['used_in_recommender']), ['used_in_recommender']);
     $setup->endSetup();
 }
 /**
  * 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();
 }
Пример #18
0
 /**
  * Installs DB schema for a module
  *
  * @param SchemaSetupInterface $setup
  * @param ModuleContextInterface $context
  * @return void
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $connection = $setup->getConnection();
     $setup->startSetup();
     $table = $connection->newTable($setup->getTable('ui_bookmark'))->addColumn('bookmark_id', Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Bookmark identifier')->addColumn('user_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false], 'User Id')->addColumn('namespace', Table::TYPE_TEXT, 255, ['nullable' => false], 'Bookmark namespace')->addColumn('identifier', Table::TYPE_TEXT, 255, ['nullable' => false], 'Bookmark Identifier')->addColumn('current', Table::TYPE_SMALLINT, 1, ['nullable' => false], 'Mark current bookmark per user and identifier')->addColumn('title', Table::TYPE_TEXT, 255, ['nullable' => true], 'Bookmark title')->addColumn('config', Table::TYPE_TEXT, Table::MAX_TEXT_SIZE, ['nullable' => true], 'Bookmark config')->addColumn('created_at', Table::TYPE_DATETIME, null, ['nullable' => false], 'Bookmark created at')->addColumn('updated_at', Table::TYPE_DATETIME, null, ['nullable' => false], 'Bookmark updated at')->addIndex($setup->getIdxName('ui_bookmark', ['user_id', 'namespace', 'identifier'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['user_id', 'namespace', 'identifier'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)->addForeignKey($setup->getFkName('ui_bookmark', 'user_id', 'admin_user', 'user_id'), 'user_id', $setup->getTable('admin_user'), 'user_id', Table::ACTION_CASCADE)->setComment('Bookmark');
     $connection->createTable($table);
     $setup->endSetup();
 }
Пример #19
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();
 }
Пример #20
0
 /**
  * {@inheritdoc}
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $contextInterface)
 {
     $setup->startSetup();
     /**
      * Create table 'catalog_product_entity_media_gallery_value_video'
      */
     $table = $setup->getConnection()->newTable($setup->getTable(self::GALLERY_VALUE_VIDEO_TABLE))->addColumn('value_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false], 'Media Entity ID')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Store ID')->addColumn('provider', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 32, ['nullable' => true, 'default' => null], 'Video provider ID')->addColumn('url', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, ['nullable' => true, 'default' => null], 'Video URL')->addColumn('title', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => true, 'default' => null], 'Title')->addColumn('description', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, ['nullable' => true, 'default' => null], 'Page Meta Description')->addColumn('metadata', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, ['nullable' => true, 'default' => null], 'Video meta data')->addIndex($setup->getIdxName(self::GALLERY_VALUE_VIDEO_TABLE, ['value_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['value_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addForeignKey($setup->getFkName(self::GALLERY_VALUE_VIDEO_TABLE, 'value_id', Gallery::GALLERY_TABLE, 'value_id'), 'value_id', $setup->getTable(Gallery::GALLERY_TABLE), 'value_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName(self::GALLERY_VALUE_VIDEO_TABLE, 'store_id', $setup->getTable('store'), 'store_id'), 'store_id', $setup->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Catalog Product Video Table');
     $setup->getConnection()->createTable($table);
     $setup->endSetup();
 }
Пример #21
0
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $tableName = $setup->getTable('ism_blog');
     if (!$setup->getConnection()->isTableExists($tableName)) {
         $table = $setup->getConnection()->newTable($tableName)->addColumn(PostInterface::ID, Table::TYPE_INTEGER, null, array('nullable' => false, 'identity' => true, 'primary' => true, 'unsigned' => true), 'ID')->addColumn(PostInterface::TITLE, Table::TYPE_TEXT, 255, array('nullable' => false), 'Post Title')->addColumn(PostInterface::DESCRIPTION, table::TYPE_TEXT, 500, array('nullable' => true), 'Post Description')->addColumn(PostInterface::CREATED_AT, Table::TYPE_DATETIME, null, array('nullable' => false), 'Created At')->addColumn(PostInterface::UPDATED_AT, Table::TYPE_DATETIME, null, array('nullable' => false), 'Updated At')->addColumn(PostInterface::IMAGE_URL, Table::TYPE_TEXT, 255, array('nullable' => true), 'Image')->addColumn(PostInterface::URL_KEY, Table::TYPE_TEXT, 255, array('nullable' => false), 'URL Key')->addColumn(PostInterface::IS_ACTIVE, Table::TYPE_BOOLEAN, null, array('nullable' => false, 'default' => '1'), 'Is Post Active?')->addIndex($setup->getIdxName('ism_blog', ['url_key']), ['url_key'])->setComment('ISM Blog Posts');
         $setup->getConnection()->createTable($table);
     }
     $setup->endSetup();
 }
Пример #22
0
 /**
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  *
  * Installs DB schema for a module
  *
  * @param SchemaSetupInterface   $setup   The setup interface
  * @param ModuleContextInterface $context The module Context
  *
  * @return void
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $connection = $setup->getConnection();
     $setup->startSetup();
     /**
      * Create table 'smile_elasticsuite_relevance_config_data'
      */
     $table = $connection->newTable($setup->getTable('smile_elasticsuite_relevance_config_data'))->addColumn('config_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Config Id')->addColumn('scope', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 30, ['nullable' => false, 'default' => 'default'], 'Config Scope')->addColumn('scope_code', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 30, ['nullable' => false, 'default' => 'default'], 'Config Scope Code')->addColumn('path', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => false, 'default' => 'general'], 'Config Path')->addColumn('value', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', [], 'Config Value')->addIndex($setup->getIdxName('smile_elasticsuite_relevance_config_data', ['scope', 'scope_id', 'path'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['scope', 'scope_code', 'path'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->setComment('Smile Elastic Suite Relevance Config Data');
     $connection->createTable($table);
     $setup->endSetup();
 }
Пример #23
0
 /**
  * Installs DB schema for the module
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  *
  * @param SchemaSetupInterface   $setup   The setup interface
  * @param ModuleContextInterface $context The module Context
  *
  * @return void
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     /**
      * Create table 'smile_virtualcategory_catalog_category_product_position'
      */
     $tableName = 'smile_virtualcategory_catalog_category_product_position';
     $table = $setup->getConnection()->newTable($setup->getTable($tableName))->addColumn('category_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], 'Category ID')->addColumn('product_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], 'Product ID')->addColumn('position', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '0'], 'Position')->addIndex($setup->getIdxName($tableName, ['product_id']), ['product_id'])->addForeignKey($setup->getFkName($tableName, 'category_id', 'catalog_category_entity', 'entity_id'), 'category_id', $setup->getTable('catalog_category_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName($tableName, 'product_id', 'catalog_product_entity', 'entity_id'), 'product_id', $setup->getTable('catalog_product_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Catalog product position for the virtual categories module.');
     $setup->getConnection()->createTable($table);
     $setup->endSetup();
 }
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $installer = $setup;
     $installer->startSetup();
     /**
      * Create table 'samplemodule_table'
      */
     $table = $installer->getConnection()->newTable($installer->getTable('barbanet_samplemodule'))->addColumn('row_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Row ID')->addColumn('title', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => false], 'Row Title')->addColumn('content', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '2M', [], 'Row Content')->addColumn('creation_time', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Row Creation Time')->addColumn('update_time', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], 'Row Modification Time')->addColumn('is_active', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['nullable' => false, 'default' => '1'], 'Is Row Active')->addIndex($setup->getIdxName($installer->getTable('barbanet_samplemodule'), ['title', 'content'], AdapterInterface::INDEX_TYPE_FULLTEXT), ['title', 'content'], ['type' => AdapterInterface::INDEX_TYPE_FULLTEXT])->setComment('Barbanet SampleModule Table');
     $installer->getConnection()->createTable($table);
     $installer->endSetup();
 }
Пример #25
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']);
     }
     if (version_compare($context->getVersion(), '2.0.2', '<')) {
         $setup->getConnection()->changeColumn($setup->getTable('quote_address'), 'street', 'street', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Street']);
     }
     $setup->endSetup();
 }
Пример #26
0
 /**
  * Upgrades DB schema for a module
  *
  * @param SchemaSetupInterface $setup
  * @param ModuleContextInterface $context
  * @return void
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     if (version_compare($context->getVersion(), '2.0.0.1') < 0) {
         $setup->startSetup();
         $connection = $setup->getConnection();
         $tableName = $setup->getTable('search_query');
         $idxName = $setup->getIdxName('search_query', ['is_processed']);
         $connection->addIndex($tableName, $idxName, ['is_processed']);
         $setup->endSetup();
     }
 }
Пример #27
0
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $installer = $setup;
     $installer->startSetup();
     /**
      * Create table 'genmato_demo'
      */
     $table = $installer->getConnection()->newTable($installer->getTable('genmato_demo'))->addColumn('demo_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Demo ID')->addColumn('title', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => false], 'Demo Title')->addColumn('creation_time', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, [], 'Creation Time')->addColumn('update_time', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, [], 'Modification Time')->addColumn('is_active', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['nullable' => false, 'default' => '1'], 'Is Active')->addIndex($setup->getIdxName($installer->getTable('genmato_demo'), ['title'], AdapterInterface::INDEX_TYPE_FULLTEXT), ['title'], ['type' => AdapterInterface::INDEX_TYPE_FULLTEXT])->setComment('Demo Table');
     $installer->getConnection()->createTable($table);
     $installer->endSetup();
 }
 /**
  * install tables
  *
  * @param \Magento\Framework\Setup\SchemaSetupInterface $setup
  * @param \Magento\Framework\Setup\ModuleContextInterface $context
  *
  * @return void
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function install(\Magento\Framework\Setup\SchemaSetupInterface $setup, \Magento\Framework\Setup\ModuleContextInterface $context)
 {
     $installer = $setup;
     $installer->startSetup();
     if (!$installer->tableExists('mageplaza_blog_post')) {
         $table = $installer->getConnection()->newTable($installer->getTable('mageplaza_blog_post'))->addColumn('post_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'nullable' => false, 'primary' => true, 'unsigned' => true], 'Post ID')->addColumn('name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable => false'], 'Post Name')->addColumn('short_description', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', [], 'Post Short Description')->addColumn('post_content', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', [], 'Post Content')->addColumn('image', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, [], 'Post Image')->addColumn('views', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, [], 'Post Views')->addColumn('enabled', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 1, [], 'Post Enabled')->addColumn('url_key', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, [], 'Post URL Key')->addColumn('in_rss', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 1, [], 'Post In RSS')->addColumn('allow_comment', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 1, [], 'Post Allow Comment')->addColumn('meta_title', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, [], 'Post Meta Title')->addColumn('meta_description', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', [], 'Post Meta Description')->addColumn('meta_keywords', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', [], 'Post Meta Keywords')->addColumn('meta_robots', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, [], 'Post Meta Robots')->addColumn('created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, [], 'Post Created At')->addColumn('updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, [], 'Post Updated At')->setComment('Post Table');
         $installer->getConnection()->createTable($table);
         $installer->getConnection()->addIndex($installer->getTable('mageplaza_blog_post'), $setup->getIdxName($installer->getTable('mageplaza_blog_post'), ['name', 'short_description', 'post_content', 'image', 'url_key', 'meta_title', 'meta_description', 'meta_keywords'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_FULLTEXT), ['name', 'short_description', 'post_content', 'image', 'url_key', 'meta_title', 'meta_description', 'meta_keywords'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_FULLTEXT);
     }
     if (!$installer->tableExists('mageplaza_blog_tag')) {
         $table = $installer->getConnection()->newTable($installer->getTable('mageplaza_blog_tag'))->addColumn('tag_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'nullable' => false, 'primary' => true, 'unsigned' => true], 'Tag ID')->addColumn('name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable => false'], 'Tag Name')->addColumn('description', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', [], 'Tag Description')->addColumn('enabled', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 1, [], 'Tag Enabled')->addColumn('created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, [], 'Tag Created At')->addColumn('updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, [], 'Tag Updated At')->addColumn('url_key', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, [], 'Tag URL Key')->setComment('Tag Table');
         $installer->getConnection()->createTable($table);
         $installer->getConnection()->addIndex($installer->getTable('mageplaza_blog_tag'), $setup->getIdxName($installer->getTable('mageplaza_blog_tag'), ['name', 'description'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_FULLTEXT), ['name', 'description'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_FULLTEXT);
     }
     if (!$installer->tableExists('mageplaza_blog_topic')) {
         $table = $installer->getConnection()->newTable($installer->getTable('mageplaza_blog_topic'))->addColumn('topic_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'nullable' => false, 'primary' => true, 'unsigned' => true], 'Topic ID')->addColumn('name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable => false'], 'Topic Name')->addColumn('description', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', [], 'Topic Description')->addColumn('enabled', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 1, [], 'Topic Enabled')->addColumn('url_key', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, [], 'Topic URL Key')->addColumn('meta_title', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, [], 'Topic Meta Title')->addColumn('meta_description', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', [], 'Topic Meta Description')->addColumn('meta_keywords', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', [], 'Topic Meta Keywords')->addColumn('meta_robots', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, [], 'Topic Meta Robots')->addColumn('created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, [], 'Topic Created At')->addColumn('updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, [], 'Topic Updated At')->setComment('Topic Table');
         $installer->getConnection()->createTable($table);
         $installer->getConnection()->addIndex($installer->getTable('mageplaza_blog_topic'), $setup->getIdxName($installer->getTable('mageplaza_blog_topic'), ['name', 'description', 'url_key', 'meta_title', 'meta_description', 'meta_keywords'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_FULLTEXT), ['name', 'description', 'url_key', 'meta_title', 'meta_description', 'meta_keywords'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_FULLTEXT);
     }
     if (!$installer->tableExists('mageplaza_blog_category')) {
         $table = $installer->getConnection()->newTable($installer->getTable('mageplaza_blog_category'))->addColumn('category_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'nullable' => false, 'primary' => true, 'unsigned' => true], 'Category ID')->addColumn('name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable => false'], 'Category Name')->addColumn('description', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', [], 'Category Description')->addColumn('url_key', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, [], 'Category URL Key')->addColumn('enabled', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 1, [], 'Category Enabled')->addColumn('meta_title', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, [], 'Category Meta Title')->addColumn('meta_description', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', [], 'Category Meta Description')->addColumn('meta_keywords', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', [], 'Category Meta Keywords')->addColumn('meta_robots', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, [], 'Category Meta Robots')->addColumn('parent_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, [], 'Category Parent Id')->addColumn('path', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, [], 'Category Path')->addColumn('position', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, [], 'Category Position')->addColumn('level', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, [], 'Category Level')->addColumn('children_count', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, [], 'Category Children Count')->addColumn('created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, [], 'Category Created At')->addColumn('updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, [], 'Category Updated At')->setComment('Category Table');
         $installer->getConnection()->createTable($table);
         $installer->getConnection()->addIndex($installer->getTable('mageplaza_blog_category'), $setup->getIdxName($installer->getTable('mageplaza_blog_category'), ['name', 'description', 'url_key', 'meta_title', 'meta_description', 'meta_keywords'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_FULLTEXT), ['name', 'description', 'url_key', 'meta_title', 'meta_description', 'meta_keywords'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_FULLTEXT);
     }
     if (!$installer->tableExists('mageplaza_blog_post_tag')) {
         $table = $installer->getConnection()->newTable($installer->getTable('mageplaza_blog_post_tag'));
         $table->addColumn('post_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Post ID')->addColumn('tag_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Tag ID')->addColumn('position', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '0'], 'Position')->addIndex($installer->getIdxName('mageplaza_blog_post_tag', ['post_id']), ['post_id'])->addIndex($installer->getIdxName('mageplaza_blog_post_tag', ['tag_id']), ['tag_id'])->addForeignKey($installer->getFkName('mageplaza_blog_post_tag', 'post_id', 'mageplaza_blog_post', 'post_id'), 'post_id', $installer->getTable('mageplaza_blog_post'), 'post_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($installer->getFkName('mageplaza_blog_post_tag', 'tag_id', 'mageplaza_blog_tag', 'tag_id'), 'tag_id', $installer->getTable('mageplaza_blog_tag'), 'tag_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addIndex($installer->getIdxName('mageplaza_blog_post_tag', ['post_id', 'tag_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['post_id', 'tag_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->setComment('Post To Tag Link Table');
         $installer->getConnection()->createTable($table);
     }
     if (!$installer->tableExists('mageplaza_blog_post_topic')) {
         $table = $installer->getConnection()->newTable($installer->getTable('mageplaza_blog_post_topic'));
         $table->addColumn('post_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Post ID')->addColumn('topic_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Topic ID')->addColumn('position', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '0'], 'Position')->addIndex($installer->getIdxName('mageplaza_blog_post_topic', ['post_id']), ['post_id'])->addIndex($installer->getIdxName('mageplaza_blog_post_topic', ['topic_id']), ['topic_id'])->addForeignKey($installer->getFkName('mageplaza_blog_post_topic', 'post_id', 'mageplaza_blog_post', 'post_id'), 'post_id', $installer->getTable('mageplaza_blog_post'), 'post_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($installer->getFkName('mageplaza_blog_post_topic', 'topic_id', 'mageplaza_blog_topic', 'topic_id'), 'topic_id', $installer->getTable('mageplaza_blog_topic'), 'topic_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addIndex($installer->getIdxName('mageplaza_blog_post_topic', ['post_id', 'topic_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['post_id', 'topic_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->setComment('Post To Topic Link Table');
         $installer->getConnection()->createTable($table);
     }
     if (!$installer->tableExists('mageplaza_blog_post_category')) {
         $table = $installer->getConnection()->newTable($installer->getTable('mageplaza_blog_post_category'));
         $table->addColumn('category_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Category ID')->addColumn('post_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Post ID')->addColumn('position', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false, 'default' => '0'], 'Position')->addIndex($installer->getIdxName('mageplaza_blog_post_category', ['category_id']), ['category_id'])->addIndex($installer->getIdxName('mageplaza_blog_post_category', ['post_id']), ['post_id'])->addForeignKey($installer->getFkName('mageplaza_blog_post_category', 'category_id', 'mageplaza_blog_category', 'category_id'), 'category_id', $installer->getTable('mageplaza_blog_category'), 'category_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($installer->getFkName('mageplaza_blog_post_category', 'post_id', 'mageplaza_blog_post', 'post_id'), 'post_id', $installer->getTable('mageplaza_blog_post'), 'post_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addIndex($installer->getIdxName('mageplaza_blog_post_category', ['category_id', 'post_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['category_id', 'post_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->setComment('Category To Post Link Table');
         $installer->getConnection()->createTable($table);
     }
     $installer->endSetup();
 }
Пример #29
0
 /**
  * @param SchemaSetupInterface $setup
  */
 public function updateSchemaVersion200(SchemaSetupInterface $setup)
 {
     /**
      * Create table 'adyen_order_payment'
      */
     $table = $setup->getConnection()->newTable($setup->getTable(self::ADYEN_ORDER_PAYMENT))->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Adyen Payment ID')->addColumn('pspreference', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['unsigned' => true, 'nullable' => false], 'Pspreference')->addColumn('merchant_reference', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['unsigned' => true, 'nullable' => false], 'Merchant Reference')->addColumn('payment_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 11, ['unsigned' => true, 'nullable' => false], 'Order Payment Id')->addColumn('payment_method', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['unsigned' => true, 'nullable' => true], 'Payment Method')->addColumn('amount', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['unsigned' => true, 'nullable' => false], 'Amount')->addColumn('total_refunded', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['unsigned' => true, 'nullable' => false], 'Total Refunded')->addColumn('created_at', Table::TYPE_DATETIME, null, ['nullable' => false], 'Created at')->addColumn('updated_at', Table::TYPE_DATETIME, null, ['nullable' => false], 'Updated at')->addIndex($setup->getIdxName(self::ADYEN_ORDER_PAYMENT, ['pspreference'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['pspreference'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addForeignKey($setup->getFkName(self::ADYEN_ORDER_PAYMENT, 'payment_id', 'sales_order_payment', 'entity_id'), 'payment_id', $setup->getTable('sales_order_payment'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Adyen Order Payment');
     $setup->getConnection()->createTable($table);
     // add originalReference to notification table
     $connection = $setup->getConnection();
     $column = ['type' => Table::TYPE_TEXT, 'length' => 255, 'nullable' => true, 'comment' => 'Original Reference', 'after' => \Adyen\Payment\Model\Notification::PSPREFRENCE];
     $connection->addColumn($setup->getTable('adyen_notification'), \Adyen\Payment\Model\Notification::ORIGINAL_REFERENCE, $column);
 }
Пример #30
0
 /**
  * {@inheritdoc}
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1', '<')) {
         /**
          * Create table 'oauth_token_request_log'
          */
         $table = $setup->getConnection()->newTable($setup->getTable('oauth_token_request_log'))->addColumn('log_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Log Id')->addColumn('user_name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 255, ['nullable' => false], 'Customer email or admin login')->addColumn('user_type', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false], 'User type (admin or customer)')->addColumn('failures_count', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => true, 'default' => 0], 'Number of failed authentication attempts in a row')->addColumn('lock_expires_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, ['nullable' => false], 'Lock expiration time')->addIndex($setup->getIdxName('oauth_token_request_log', ['user_name', 'user_type'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['user_name', 'user_type'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->setComment('Log of token request authentication failures.');
         $setup->getConnection()->createTable($table);
     }
     $setup->endSetup();
 }