/** * {@inheritdoc} * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); if (!$installer->tableExists('signifyd_connect_case')) { $table = $installer->getConnection()->newTable($installer->getTable('signifyd_connect_case')); $table->addColumn('order_increment', Table::TYPE_TEXT, 255, ['nullable' => false, 'primary' => true], 'Order ID')->addColumn('signifyd_status', Table::TYPE_TEXT, 255, ['nullable' => false, 'default' => 'PENDING'], 'Signifyd Status')->addColumn('code', Table::TYPE_TEXT, 255, ['nullable' => false], 'Code')->addColumn('score', Table::TYPE_FLOAT, null, [], 'Score')->addColumn('guarantee', Table::TYPE_TEXT, 64, ['nullable' => false, 'default' => 'N/A'], 'Guarantee Status')->addColumn('entries_text', Table::TYPE_TEXT, null, ['nullable' => false], 'Entries')->addColumn('created', Table::TYPE_TIMESTAMP, null, [], 'Creation Time')->addColumn('updated', Table::TYPE_TIMESTAMP, null, [], 'Update Time')->setComment('Signifyd Cases'); $installer->getConnection()->createTable($table); } // Retry table, stores orders that fail to pose as cases if (!$installer->tableExists('signifyd_connect_retries')) { $table = $installer->getConnection()->newTable($installer->getTable('signifyd_connect_retries')); $table->addColumn('order_increment', Table::TYPE_TEXT, 255, ['nullable' => false, 'primary' => true], 'Order ID')->addColumn('created', Table::TYPE_TIMESTAMP, null, [], 'Creation Time')->addColumn('updated', Table::TYPE_TIMESTAMP, null, [], 'Last Attempt')->setComment('Signifyd Retries'); $installer->getConnection()->createTable($table); } // The plan here is to add the signifyd case data directly to the order tables $tableName = $setup->getTable('sales_order'); $gridTableName = $setup->getTable('sales_order_grid'); if ($installer->getConnection()->isTableExists($tableName)) { $columns = ['signifyd_score' => ['type' => Table::TYPE_FLOAT, 'default' => null, 'comment' => 'Score'], 'signifyd_guarantee' => ['type' => Table::TYPE_TEXT, 'LENGTH' => 64, 'default' => 'N/A', 'nullable' => false, 'comment' => 'Guarantee Status'], 'signifyd_code' => ['type' => Table::TYPE_TEXT, 'LENGTH' => 255, 'default' => '', 'nullable' => false, 'comment' => 'Code']]; $connection = $setup->getConnection(); foreach ($columns as $name => $definition) { $connection->dropColumn($tableName, $name); $connection->addColumn($tableName, $name, $definition); $connection->dropColumn($gridTableName, $name); $connection->addColumn($gridTableName, $name, $definition); } } }
/** * 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} * @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'); } }
/** * {@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(); }
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); if (version_compare($context->getVersion(), '1.1.2', '<')) { // Get module table $tableName = $setup->getTable('lr_addresses'); // Check if the table already exists if ($setup->getConnection()->isTableExists($tableName) == true) { // Declare data $columns = ['country' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'nullable' => false, 'comment' => 'country name']]; $connection = $setup->getConnection(); foreach ($columns as $name => $definition) { $connection->addColumn($tableName, $name, $definition); } } // Get module table $tableNameExtendedProfile = $setup->getTable('lr_extended_profile_data'); // Check if the table already exists if ($setup->getConnection()->isTableExists($tableNameExtendedProfile) == true) { // Declare data $columnsAdd = ['no_of_login' => ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'nullable' => false, 'comment' => 'no of login']]; $connectionData = $setup->getConnection(); foreach ($columnsAdd as $name => $definition) { $connectionData->addColumn($tableNameExtendedProfile, $name, $definition); } } } $setup->endSetup(); }
/** * {@inheritdoc} */ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); $connection = $setup->getConnection(); if (version_compare($context->getVersion(), '1.1.0', '<')) { //remove quote table $connection->dropTable($setup->getTable('email_quote')); } if (version_compare($context->getVersion(), '2.0.6', '<')) { //modify email_campaign table $campaignTable = $setup->getTable('email_campaign'); //add columns $connection->addColumn($campaignTable, 'send_id', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'nullable' => false, 'default' => '', 'comment' => 'Campaign Send Id']); $connection->addColumn($campaignTable, 'send_status', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'nullable' => false, 'default' => 0, 'comment' => 'Send Status']); if ($connection->tableColumnExists($campaignTable, 'is_sent')) { //update table with historical send values $select = $connection->select(); //join $select->joinLeft(['oc' => $campaignTable], "oc.id = nc.id", ['send_status' => new \Zend_Db_Expr(\Dotdigitalgroup\Email\Model\Campaign::SENT)])->where('oc.is_sent =?', 1); //update query from select $updateSql = $select->crossUpdateFromSelect(['nc' => $campaignTable]); //run query $connection->query($updateSql); //remove column $connection->dropColumn($campaignTable, 'is_sent'); } //add index $connection->addIndex($campaignTable, $setup->getIdxName($campaignTable, ['send_status']), ['send_status']); } if (version_compare($context->getVersion(), '2.1.0', '<')) { $couponTable = $setup->getTable('salesrule_coupon'); $connection->addColumn($couponTable, 'generated_by_dotmailer', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'nullable' => true, 'default' => null, 'comment' => '1 = Generated by dotmailer']); } $setup->endSetup(); }
/** * 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 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(); }
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(); }
/** * {@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(); }
/** * {@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); } }
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(); }
/** * {@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(); }
/** * {@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(); }
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(); }
/** * {@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(); }
/** * 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} */ 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(); }
/** * {@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(); }
/** * @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); }
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); $table = $setup->getConnection()->newTable($setup->getTable('foggyline_sentinel_access_log'))->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Entity ID')->addColumn('request_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Unique HTTP request ID')->addColumn('created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At')->addColumn('user_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => true], 'Modified by User ID')->addColumn('user_username', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'User Username')->addColumn('user_email', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'User Email')->addColumn('user_name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'User Full Name')->addColumn('action_name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Action Name')->addColumn('full_action_name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Full Action Name')->addColumn('client_ip', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Client IP')->addColumn('request_string', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Request String')->addColumn('request_method', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Request Method')->addColumn('http_get_params', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'HTTP GET Params')->addColumn('http_post_params', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'HTTP POST Params')->addColumn('http_files_params', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'HTTP FILES Params')->addColumn('module_name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Module Name')->addColumn('controller_module', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Controller Module')->addColumn('area', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Area')->setComment('Foggyline Sentinel Log Table'); $setup->getConnection()->createTable($table); $table = $setup->getConnection()->newTable($setup->getTable('foggyline_sentinel_login_log'))->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Entity ID')->addColumn('request_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Unique HTTP request ID')->addColumn('created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => true], 'Store ID')->addColumn('type', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Type (user, customer, rest_api, soap_api)')->addColumn('identifier', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Identifier')->addColumn('login_status', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Login Status')->setComment('Foggyline Sentinel Login Log Table'); $setup->getConnection()->createTable($table); $table = $setup->getConnection()->newTable($setup->getTable('foggyline_sentinel_curl_log'))->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Entity ID')->addColumn('request_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Unique HTTP request ID')->addColumn('created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At')->addColumn('store_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => true], 'Store ID')->addColumn('result', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Result')->addColumn('method', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Method')->addColumn('url', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Url')->addColumn('http_ver', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'HTTP version')->addColumn('headers', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Headers')->addColumn('body', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'body')->addColumn('http_code', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'HTTP Code')->addColumn('total_time', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Total Time')->addColumn('name_lookup_time', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'name_lookup_time')->addColumn('primary_ip', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Primary IP')->addColumn('primary_port', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Primary Port')->addColumn('local_ip', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Local IP')->addColumn('local_port', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Local Port')->addColumn('size_upload', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Size Upload')->addColumn('size_download', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Size Download')->addColumn('speed_download', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Speed Download')->addColumn('speed_upload', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Speed Upload')->addColumn('content_type', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Content Type')->setComment('Foggyline Sentinel cURL Log Table'); $setup->getConnection()->createTable($table); $table = $setup->getConnection()->newTable($setup->getTable('foggyline_sentinel_query_log'))->addColumn('entity_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Entity ID')->addColumn('created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At')->addColumn('type', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, ['nullable' => true], 'Type')->addColumn('time', \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, '12,4', ['nullable' => false, 'default' => '0.0000'], 'Time')->addColumn('sql', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'SQL')->addColumn('bind', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Bind')->addColumn('row_count', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, [], 'Row Count')->addColumn('request_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Unique HTTP request ID')->addColumn('backtrace', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, null, [], 'Backtrace')->setComment('Foggyline Sentinel Login Log Table'); $setup->getConnection()->createTable($table); $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(); if (version_compare($context->getVersion(), '1.0.1', '<')) { $setup->getConnection()->addColumn($setup->getTable('fastgento_locator'), 'image', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'nullable' => true, 'comment' => 'Location image attribute']); } if (version_compare($context->getVersion(), '1.0.2', '<')) { /** * Drop entity Id columns */ $setup->getConnection()->dropColumn($setup->getTable('fastgento_locator'), 'image'); $setup->getConnection()->addColumn($setup->getTable('fastgento_locator'), 'image', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'nullable' => true, 'comment' => 'Location image attribute']); } $setup->endSetup(); }
/** * {@inheritdoc} */ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); if (version_compare($context->getVersion(), '2.0.0.1') < 0) { $connection = $setup->getConnection(); $connection->addIndex($setup->getTable('customer_visitor'), $setup->getIdxName('customer_visitor', ['last_visit_at']), ['last_visit_at']); } if (version_compare($context->getVersion(), '2.0.1', '<')) { $setup->getConnection()->addColumn($setup->getTable('customer_eav_attribute'), 'is_used_in_grid', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'unsigned' => true, 'nullable' => false, 'default' => '0', 'comment' => 'Is Used in Grid']); $setup->getConnection()->addColumn($setup->getTable('customer_eav_attribute'), 'is_visible_in_grid', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'unsigned' => true, 'nullable' => false, 'default' => '0', 'comment' => 'Is Visible in Grid']); $setup->getConnection()->addColumn($setup->getTable('customer_eav_attribute'), 'is_filterable_in_grid', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'unsigned' => true, 'nullable' => false, 'default' => '0', 'comment' => 'Is Filterable in Grid']); $setup->getConnection()->addColumn($setup->getTable('customer_eav_attribute'), 'is_searchable_in_grid', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'unsigned' => true, 'nullable' => false, 'default' => '0', 'comment' => 'Is Searchable in Grid']); } $setup->endSetup(); }
/** * Add foreign keys to entity table * * @return void */ protected function addForeignKeys() { $foreignKeys = $this->setup->getConnection()->getForeignKeys( $this->setup->getTable($this->entityTable) ); $foreignKeys = array_filter( $foreignKeys, function ($key) { return $key['COLUMN_NAME'] == $this->entityColumn; } ); foreach ($foreignKeys as $foreignKeyInfo) { if (!count($this->getForeignKeys( $this->externalTable, $this->externalColumn, $this->setup->getTablePlaceholder($foreignKeyInfo['REF_TABLE_NAME']), $foreignKeyInfo['REF_COLUMN_NAME'] ))) { $this->setup->getConnection()->addForeignKey( $this->setup->getFkName( $this->externalTable, $this->externalColumn, $this->setup->getTablePlaceholder($foreignKeyInfo['REF_TABLE_NAME']), $foreignKeyInfo['REF_COLUMN_NAME'] ), $this->setup->getTable($this->externalTable), $this->externalColumn, $foreignKeyInfo['REF_TABLE_NAME'], $foreignKeyInfo['REF_COLUMN_NAME'], $this->onDelete ); } } }
public function uninstall(SchemaSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); $connection = $setup->getConnection(); $connection->dropTable($setup->getTable('algoliasearch_queue')); $setup->endSetup(); }
/** * {@inheritdoc} */ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { if (version_compare($context->getVersion(), '2.0.1') < 0) { $installer = $setup; /** * update columns created_at and updated_at in sales entities tables */ $tables = ['sales_creditmemo', 'sales_creditmemo_comment', 'sales_invoice', 'sales_invoice_comment', 'sales_order', 'sales_order_item', 'sales_order_status_history', 'sales_payment_transaction', 'sales_shipment', 'sales_shipment_comment', 'sales_shipment_track']; /** @var \Magento\Framework\DB\Adapter\AdapterInterface $connection */ $connection = $installer->getConnection(); foreach ($tables as $table) { $columns = $connection->describeTable($installer->getTable($table)); if (isset($columns['created_at'])) { $createdAt = $columns['created_at']; $createdAt['DEFAULT'] = Table::TIMESTAMP_INIT; $createdAt['TYPE'] = Table::TYPE_TIMESTAMP; $connection->modifyColumn($installer->getTable($table), 'created_at', $createdAt); } if (isset($columns['updated_at'])) { $updatedAt = $columns['updated_at']; $updatedAt['DEFAULT'] = Table::TIMESTAMP_UPDATE; $updatedAt['TYPE'] = Table::TYPE_TIMESTAMP; $connection->modifyColumn($installer->getTable($table), 'updated_at', $updatedAt); } } } if (version_compare($context->getVersion(), '2.0.2') < 0) { /** * Adding 'updated_at' columns. */ $tables = ['sales_shipment_grid', 'sales_invoice_grid', 'sales_creditmemo_grid']; foreach ($tables as $table) { $table = $setup->getTable($table); $setup->getConnection()->addColumn($table, 'updated_at', ['type' => Table::TYPE_TIMESTAMP, 'after' => 'created_at', 'comment' => 'Updated At']); $setup->getConnection()->addIndex($table, $setup->getIdxName($table, ['updated_at']), 'updated_at'); } /** * Modifying default value of 'updated_at' columns. */ $tables = ['sales_order', 'sales_shipment', 'sales_invoice', 'sales_creditmemo']; foreach ($tables as $table) { $table = $setup->getTable($table); $setup->getConnection()->modifyColumn($table, 'updated_at', ['type' => Table::TYPE_TIMESTAMP, 'default' => Table::TIMESTAMP_INIT_UPDATE]); } } }
/** * {@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(); }
/** * {@inheritdoc} */ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); if (version_compare($context->getVersion(), '2.0.1', '<')) { $setup->getConnection()->addIndex($setup->getTable('quote_id_mask'), $setup->getIdxName('quote_id_mask', ['masked_id']), ['masked_id']); } $setup->endSetup(); }
/** * {@inheritdoc} */ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { $connection = $setup->getConnection(); if (version_compare($context->getVersion(), '2.0.1', '<')) { $column = ['type' => Table::TYPE_SMALLINT, 'length' => 6, 'nullable' => false, 'comment' => 'Applied mode', 'default' => '0']; $connection->addColumn($setup->getTable('checkout_agreement'), 'mode', $column); } }
/** * {@inheritdoc} */ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); if (version_compare($context->getVersion(), '0.1.3', '<')) { // Add column to invoice and credit memo tables for avatax responses $setup->getConnection()->addColumn($setup->getTable('sales_invoice'), 'avatax_is_unbalanced', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'length' => 1, 'nullable' => true, 'default' => null, 'unsigned' => true, 'comment' => 'Is Unbalanced In Relation To AvaTax Calculated Tax Amount']); $setup->getConnection()->addColumn($setup->getTable('sales_creditmemo'), 'avatax_is_unbalanced', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'length' => 1, 'nullable' => true, 'default' => null, 'unsigned' => true, 'comment' => 'Is Unbalanced In Relation To AvaTax Calculated Tax Amount']); $setup->getConnection()->addColumn($setup->getTable('sales_invoice'), 'base_avatax_tax_amount', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, 'length' => '12,4', 'nullable' => true, 'default' => null, 'unsigned' => false, 'comment' => 'Base AvaTax Calculated Tax Amount']); $setup->getConnection()->addColumn($setup->getTable('sales_creditmemo'), 'base_avatax_tax_amount', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, 'length' => '12,4', 'nullable' => true, 'default' => null, 'unsigned' => false, 'comment' => 'Base AvaTax Calculated Tax Amount']); } if (version_compare($context->getVersion(), '0.1.4', '<')) { /** * Add "avatax_code" column to tax_class table */ $setup->getConnection()->addColumn($setup->getTable('tax_class'), 'avatax_code', ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'nullable' => true, 'default' => null, 'comment' => 'AvaTax Code']); } $setup->endSetup(); }