Пример #1
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();
 }
Пример #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();
 }
Пример #3
0
 public function uninstall(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $connection = $setup->getConnection();
     $connection->dropTable($setup->getTable('algoliasearch_queue'));
     $setup->endSetup();
 }
Пример #4
0
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $table = $setup->getConnection()->newTable($setup->getTable('harvey_office_department'))->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Entity ID')->addColumn('name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 64, [], 'Name')->setComment('Harvey Office Department Table');
     $setup->getConnection()->createTable($table);
     $employeeEntity = \Harvey\Office\Model\Employee::ENTITY;
     $table = $setup->getConnection()->newTable($setup->getTable($employeeEntity . '_entity'))->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Entity ID')->addColumn('department_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false], 'Department Id')->addColumn('email', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 64, [], 'Email')->addColumn('first_name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 64, [], 'First Name')->addColumn('last_name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 64, [], 'Last Name')->setComment('Harvey Office Employee Table');
     $setup->getConnection()->createTable($table);
     //Create entity attribute value table
     //bluecom_office_employee_entity_decimal
     $table = $setup->getConnection()->newTable($setup->getTable($employeeEntity . '_entity_decimal'))->addColumn('value_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Value ID')->addColumn('attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Attribute ID')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Store ID')->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Entity ID')->addColumn('value', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', [], 'Value')->addIndex($setup->getIdxName($employeeEntity . '_entity_decimal', ['entity_id', 'attribute_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['entity_id', 'attribute_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addIndex($setup->getIdxName($employeeEntity . '_entity_decimal', ['store_id']), ['store_id'])->addIndex($setup->getIdxName($employeeEntity . '_entity_decimal', ['attribute_id']), ['attribute_id'])->addForeignKey($setup->getFkName($employeeEntity . '_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), 'attribute_id', $setup->getTable('eav_attribute'), 'attribute_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName($employeeEntity . '_entity_decimal', 'entity_id', $employeeEntity . '_entity', 'entity_id'), 'entity_id', $setup->getTable($employeeEntity . '_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName($employeeEntity . '_entity_decimal', 'store_id', 'store', 'store_id'), 'store_id', $setup->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Employee Decimal Attribute Backend Table');
     $setup->getConnection()->createTable($table);
     //bluecom_office_employee_entity_int
     $table = $setup->getConnection()->newTable($setup->getTable($employeeEntity . '_entity_int'))->addColumn('value_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Value ID')->addColumn('attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Attribute ID')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Store ID')->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Entity ID')->addColumn('value', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, '10', [], 'Value')->addIndex($setup->getIdxName($employeeEntity . '_entity_int', ['entity_id', 'attribute_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['entity_id', 'attribute_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addIndex($setup->getIdxName($employeeEntity . '_entity_int', ['store_id']), ['store_id'])->addIndex($setup->getIdxName($employeeEntity . '_entity_int', ['attribute_id']), ['attribute_id'])->addForeignKey($setup->getFkName($employeeEntity . '_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), 'attribute_id', $setup->getTable('eav_attribute'), 'attribute_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName($employeeEntity . '_entity_int', 'entity_id', $employeeEntity . '_entity', 'entity_id'), 'entity_id', $setup->getTable($employeeEntity . '_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName($employeeEntity . '_entity_int', 'store_id', 'store', 'store_id'), 'store_id', $setup->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Employee Int Attribute Backend Table');
     $setup->getConnection()->createTable($table);
     //bluecom_office_employee_entity_varchar
     $table = $setup->getConnection()->newTable($setup->getTable($employeeEntity . '_entity_varchar'))->addColumn('value_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Value ID')->addColumn('attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Attribute ID')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Store ID')->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Entity ID')->addColumn('value', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '255', [], 'Value')->addIndex($setup->getIdxName($employeeEntity . '_entity_varchar', ['entity_id', 'attribute_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['entity_id', 'attribute_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addIndex($setup->getIdxName($employeeEntity . '_entity_varchar', ['store_id']), ['store_id'])->addIndex($setup->getIdxName($employeeEntity . '_entity_varchar', ['attribute_id']), ['attribute_id'])->addForeignKey($setup->getFkName($employeeEntity . '_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), 'attribute_id', $setup->getTable('eav_attribute'), 'attribute_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName($employeeEntity . '_entity_varchar', 'entity_id', $employeeEntity . '_entity', 'entity_id'), 'entity_id', $setup->getTable($employeeEntity . '_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName($employeeEntity . '_entity_varchar', 'store_id', 'store', 'store_id'), 'store_id', $setup->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Employee Varchar Attribute Backend Table');
     $setup->getConnection()->createTable($table);
     //bluecom_office_employee_entity_text
     $table = $setup->getConnection()->newTable($setup->getTable($employeeEntity . '_entity_text'))->addColumn('value_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Value ID')->addColumn('attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Attribute ID')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Store ID')->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Entity ID')->addColumn('value', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, '64k', [], 'Value')->addIndex($setup->getIdxName($employeeEntity . '_entity_text', ['entity_id', 'attribute_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['entity_id', 'attribute_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addIndex($setup->getIdxName($employeeEntity . '_entity_text', ['store_id']), ['store_id'])->addIndex($setup->getIdxName($employeeEntity . '_entity_text', ['attribute_id']), ['attribute_id'])->addForeignKey($setup->getFkName($employeeEntity . '_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), 'attribute_id', $setup->getTable('eav_attribute'), 'attribute_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName($employeeEntity . '_entity_text', 'entity_id', $employeeEntity . '_entity', 'entity_id'), 'entity_id', $setup->getTable($employeeEntity . '_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName($employeeEntity . '_entity_text', 'store_id', 'store', 'store_id'), 'store_id', $setup->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Employee Text Attribute Backend Table');
     $setup->getConnection()->createTable($table);
     //bluecom_office_employee_entity_text
     $table = $setup->getConnection()->newTable($setup->getTable($employeeEntity . '_entity_datetime'))->addColumn('value_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Value ID')->addColumn('attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Attribute ID')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Store ID')->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false, 'default' => '0'], 'Entity ID')->addColumn('value', \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, null, [], 'Value')->addIndex($setup->getIdxName($employeeEntity . '_entity_datetime', ['entity_id', 'attribute_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), ['entity_id', 'attribute_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE])->addIndex($setup->getIdxName($employeeEntity . '_entity_datetime', ['store_id']), ['store_id'])->addIndex($setup->getIdxName($employeeEntity . '_entity_datetime', ['attribute_id']), ['attribute_id'])->addForeignKey($setup->getFkName($employeeEntity . '_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), 'attribute_id', $setup->getTable('eav_attribute'), 'attribute_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName($employeeEntity . '_entity_datetime', 'entity_id', $employeeEntity . '_entity', 'entity_id'), 'entity_id', $setup->getTable($employeeEntity . '_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->addForeignKey($setup->getFkName($employeeEntity . '_entity_datetime', 'store_id', 'store', 'store_id'), 'store_id', $setup->getTable('store'), 'store_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Employee Datetime Attribute Backend Table');
     $setup->getConnection()->createTable($table);
     $setup->endSetup();
 }
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '1.1.2', '<')) {
         // Get module table
         $tableName = $setup->getTable('lr_addresses');
         // Check if the table already exists
         if ($setup->getConnection()->isTableExists($tableName) == true) {
             // Declare data
             $columns = ['country' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'nullable' => false, 'comment' => 'country name']];
             $connection = $setup->getConnection();
             foreach ($columns as $name => $definition) {
                 $connection->addColumn($tableName, $name, $definition);
             }
         }
         // Get module table
         $tableNameExtendedProfile = $setup->getTable('lr_extended_profile_data');
         // Check if the table already exists
         if ($setup->getConnection()->isTableExists($tableNameExtendedProfile) == true) {
             // Declare data
             $columnsAdd = ['no_of_login' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'nullable' => false, 'comment' => 'no of login']];
             $connectionData = $setup->getConnection();
             foreach ($columnsAdd as $name => $definition) {
                 $connectionData->addColumn($tableNameExtendedProfile, $name, $definition);
             }
         }
     }
     $setup->endSetup();
 }
 /**
  * Upgrades DB schema for a module
  *
  * @param SchemaSetupInterface $setup
  * @param ModuleContextInterface $context
  * @return void
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $quoteAddressTable = 'quote_address';
     $quoteTable = 'quote';
     $orderTable = 'sales_order';
     $invoiceTable = 'sales_invoice';
     $creditmemoTable = 'sales_creditmemo';
     //Setup two columns for quote, quote_address and order
     //Quote address tables
     $setup->getConnection()->addColumn($setup->getTable($quoteAddressTable), 'fee', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '10,2', 'default' => 0.0, 'nullable' => true, 'comment' => 'Fee']);
     $setup->getConnection()->addColumn($setup->getTable($quoteAddressTable), 'base_fee', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '10,2', 'default' => 0.0, 'nullable' => true, 'comment' => 'Base Fee']);
     //Quote tables
     $setup->getConnection()->addColumn($setup->getTable($quoteTable), 'fee', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '10,2', 'default' => 0.0, 'nullable' => true, 'comment' => 'Fee']);
     $setup->getConnection()->addColumn($setup->getTable($quoteTable), 'base_fee', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '10,2', 'default' => 0.0, 'nullable' => true, 'comment' => 'Base Fee']);
     //Order tables
     $setup->getConnection()->addColumn($setup->getTable($orderTable), 'fee', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '10,2', 'default' => 0.0, 'nullable' => true, 'comment' => 'Fee']);
     $setup->getConnection()->addColumn($setup->getTable($orderTable), 'base_fee', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '10,2', 'default' => 0.0, 'nullable' => true, 'comment' => 'Base Fee']);
     //Invoice tables
     $setup->getConnection()->addColumn($setup->getTable($invoiceTable), 'fee', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '10,2', 'default' => 0.0, 'nullable' => true, 'comment' => 'Fee']);
     $setup->getConnection()->addColumn($setup->getTable($invoiceTable), 'base_fee', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '10,2', 'default' => 0.0, 'nullable' => true, 'comment' => 'Base Fee']);
     //Credit memo tables
     $setup->getConnection()->addColumn($setup->getTable($creditmemoTable), 'fee', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '10,2', 'default' => 0.0, 'nullable' => true, 'comment' => 'Fee']);
     $setup->getConnection()->addColumn($setup->getTable($creditmemoTable), 'base_fee', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '10,2', 'default' => 0.0, 'nullable' => true, 'comment' => 'Base Fee']);
     $setup->endSetup();
 }
 /**
  * {@inheritdoc}
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $connection = $setup->getConnection();
     if (version_compare($context->getVersion(), '1.1.0', '<')) {
         //remove quote table
         $connection->dropTable($setup->getTable('email_quote'));
     }
     if (version_compare($context->getVersion(), '2.0.6', '<')) {
         //modify email_campaign table
         $campaignTable = $setup->getTable('email_campaign');
         //add columns
         $connection->addColumn($campaignTable, 'send_id', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'nullable' => false, 'default' => '', 'comment' => 'Campaign Send Id']);
         $connection->addColumn($campaignTable, 'send_status', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'nullable' => false, 'default' => 0, 'comment' => 'Send Status']);
         if ($connection->tableColumnExists($campaignTable, 'is_sent')) {
             //update table with historical send values
             $select = $connection->select();
             //join
             $select->joinLeft(['oc' => $campaignTable], "oc.id = nc.id", ['send_status' => new \Zend_Db_Expr(\Dotdigitalgroup\Email\Model\Campaign::SENT)])->where('oc.is_sent =?', 1);
             //update query from select
             $updateSql = $select->crossUpdateFromSelect(['nc' => $campaignTable]);
             //run query
             $connection->query($updateSql);
             //remove column
             $connection->dropColumn($campaignTable, 'is_sent');
         }
         //add index
         $connection->addIndex($campaignTable, $setup->getIdxName($campaignTable, ['send_status']), ['send_status']);
     }
     if (version_compare($context->getVersion(), '2.1.0', '<')) {
         $couponTable = $setup->getTable('salesrule_coupon');
         $connection->addColumn($couponTable, 'generated_by_dotmailer', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'nullable' => true, 'default' => null, 'comment' => '1 = Generated by dotmailer']);
     }
     $setup->endSetup();
 }
Пример #8
0
 /**
  * {@inheritdoc}
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $this->setup = $setup;
     $setup->startSetup();
     $this->createTables();
     $setup->endSetup();
 }
Пример #9
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();
 }
Пример #10
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();
 }
Пример #11
0
 public function uninstall(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $setup->getConnection()->dropTable('osmansorkar_blog_post');
     $setup->getConnection()->dropTable('osmansorkar_blog_category');
     $setup->getConnection()->dropTable('osmansorkar_post_category');
     $setup->endSetup();
 }
Пример #12
0
 /**
  * {@inheritdoc}
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1', '<')) {
         $setup->getConnection()->addIndex($setup->getTable('quote_id_mask'), $setup->getIdxName('quote_id_mask', ['masked_id']), ['masked_id']);
     }
     $setup->endSetup();
 }
Пример #13
0
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     if ($this->helperFactory->getObject('Module\\Maintenance\\Setup')->isEnabled()) {
         return;
     }
     $this->helperFactory->getObject('Module\\Maintenance\\Setup')->enable();
     $this->installer = $setup;
     $this->installer->startSetup();
     try {
         $this->installGeneral();
         $this->installEbay();
         $this->installAmazon();
     } catch (\Exception $exception) {
         return;
     }
     $this->installer->endSetup();
 }
Пример #14
0
 /**
  * {@inheritdoc}
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $installer = $setup;
     $installer->startSetup();
     $connection = $installer->getConnection();
     $invoiceTable = $installer->getTable('sales_invoice');
     $creditMemoTable = $installer->getTable('sales_creditmemo');
     $salesTable = $installer->getTable('sales_order');
     $quoteTable = $installer->getTable('quote');
     /*********** VERSION 1.0.2 ADD FINANCE COST COLUMNS TO INVOICE AND CREDITMEMO ***********/
     if (version_compare($context->getVersion(), '1.0.2', '<=')) {
         $columns = ['finance_cost_amount' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, 'length' => '12,4', 'nullable' => true, 'comment' => 'Finance Cost Amount'], 'base_finance_cost_amount' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, 'length' => '12,4', 'nullable' => true, 'comment' => 'Base Finance Cost Amount']];
         foreach ($columns as $name => $definition) {
             $connection->addColumn($invoiceTable, $name, $definition);
             $connection->addColumn($creditMemoTable, $name, $definition);
         }
     }
     /*********** VERSION 1.0.3 ADD DISCOUNT COUPON COLUMNS TO ORDER, QUOTE, INVOICE, CREDITMEMO ***********/
     if (version_compare($context->getVersion(), '1.0.3', '<=')) {
         $columns = ['discount_coupon_amount' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, 'length' => '12,4', 'nullable' => true, 'comment' => 'Discount coupon Amount'], 'base_discount_coupon_amount' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, 'length' => '12,4', 'nullable' => true, 'comment' => 'Base Discount coupon Amount']];
         foreach ($columns as $name => $definition) {
             $connection->addColumn($invoiceTable, $name, $definition);
             $connection->addColumn($creditMemoTable, $name, $definition);
             $connection->addColumn($salesTable, $name, $definition);
             $connection->addColumn($quoteTable, $name, $definition);
         }
     }
     /*********** VERSION 1.0.4 ADD DISCOUNT COUPON COLUMNS TO QUOTE_ADDRESS ***********/
     if (version_compare($context->getVersion(), '1.0.4', '<=')) {
         $quoteAddressTable = $installer->getTable('quote_address');
         $columns = ['discount_coupon_amount' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, 'length' => '12,4', 'nullable' => true, 'comment' => 'Discount coupon Amount'], 'base_discount_coupon_amount' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, 'length' => '12,4', 'nullable' => true, 'comment' => 'Base Discount coupon Amount']];
         foreach ($columns as $name => $definition) {
             $connection->addColumn($quoteAddressTable, $name, $definition);
         }
     }
     $setup->endSetup();
     /*********** VERSION 1.0.5 ADD FINANCING COST COLUMN TO QUOTE_ADDRESS ***********/
     if (version_compare($context->getVersion(), '1.0.5', '<=')) {
         $quoteAddressTable = $installer->getTable('quote_address');
         $columns = ['finance_cost_amount' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, 'length' => '12,4', 'nullable' => true, 'comment' => 'Finance Cost Amount'], 'base_finance_cost_amount' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, 'length' => '12,4', 'nullable' => true, 'comment' => 'Base Finance Cost Amount']];
         foreach ($columns as $name => $definition) {
             $connection->addColumn($quoteAddressTable, $name, $definition);
         }
     }
     $setup->endSetup();
 }
 /**
  * {@inheritdoc}
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.7.0', '<')) {
         $setup->getConnection()->addColumn($setup->getTable('barbanet_samplemodule'), 'description', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'nullable' => false, 'comment' => 'Row description']);
     }
     $setup->endSetup();
 }
Пример #16
0
 /**
  * @inheritdoc
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $this->_context = $context;
     $setup->startSetup();
     /* perform module specific operations */
     $this->_setup();
     $setup->endSetup();
 }
Пример #17
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();
 }
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $employeeEntityTable = \Foggyline\Office\Model\Employee::ENTITY . '_entity';
     $departmentEntityTable = 'foggyline_office_department';
     $setup->getConnection()->addForeignKey($setup->getFkName($employeeEntityTable, 'department_id', $departmentEntityTable, 'entity_id'), $setup->getTable($employeeEntityTable), 'department_id', $setup->getTable($departmentEntityTable), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE);
     $setup->endSetup();
 }
Пример #19
0
 /**
  * {@inheritdoc}
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1', '<')) {
         $setup->getConnection()->changeColumn($setup->getTable(\Magento\Security\Setup\InstallSchema::ADMIN_SESSIONS_DB_TABLE_NAME), 'ip', 'ip', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 15, 'nullable' => false, 'comment' => 'Remote user IP']);
         $setup->getConnection()->changeColumn($setup->getTable(\Magento\Security\Setup\InstallSchema::PASSWORD_RESET_REQUEST_EVENT_DB_TABLE_NAME), 'ip', 'ip', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 15, 'nullable' => false, 'comment' => 'Remote user IP']);
     }
     $setup->endSetup();
 }
Пример #20
0
 /**
  * {@inheritdoc}
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '0.1.1', '<')) {
         $connection = $setup->getConnection();
         $column = ['type' => Table::TYPE_SMALLINT, 'length' => 6, 'nullable' => false, 'comment' => 'Is Visible', 'default' => '1'];
         $connection->addColumn($setup->getTable('genmato_demo'), 'is_visible', $column);
     }
     $setup->endSetup();
 }
Пример #21
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();
 }
Пример #22
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();
 }
 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();
 }
Пример #24
0
 /**
  * {@inheritdoc}
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $tableName = $setup->getTable('revoslider_slider');
     if (!$setup->getConnection()->isTableExists($tableName)) {
         $table = $setup->getConnection()->newTable($tableName)->addColumn('entity_id', Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Entity ID')->addColumn('title', Table::TYPE_TEXT, 255, ['nullable' => false], 'Recipe title')->addColumn('description', Table::TYPE_TEXT, '64k', [], 'Recipe description')->setComment('RevoSlider Table');
         $setup->getConnection()->createTable($table);
     }
     $setup->endSetup();
 }
Пример #25
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();
 }
Пример #26
0
 /**
  * {@inheritdoc}
  */
 public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $connection = $setup->getConnection();
     if (version_compare($context->getVersion(), '1.1.0', '<')) {
         //remove quote table
         $connection->dropTable($setup->getTable('email_quote'));
     }
     $setup->endSetup();
 }
Пример #27
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();
 }
Пример #28
0
 /**
  * {@inheritdoc}
  */
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $connection = $setup->getConnection();
     /**
      * Create table 'vde_theme_change'
      */
     $table = $connection->newTable($setup->getTable('vde_theme_change'))->addColumn('change_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Theme Change Identifier')->addColumn('theme_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false, 'unsigned' => true], 'Theme Id')->addColumn('change_time', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, ['nullable' => false], 'Change Time')->addForeignKey($setup->getFkName('vde_theme_change', 'theme_id', 'theme', 'theme_id'), 'theme_id', $setup->getTable('theme'), 'theme_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE)->setComment('Design Editor Theme Change');
     $connection->createTable($table);
     $setup->endSetup();
 }
Пример #29
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();
 }
Пример #30
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();
 }