diff --git a/app/code/Magento/Backend/etc/module.xml b/app/code/Magento/Backend/etc/module.xml index 91d3eee738c3f..a2d0faca404af 100644 --- a/app/code/Magento/Backend/etc/module.xml +++ b/app/code/Magento/Backend/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Backup/etc/module.xml b/app/code/Magento/Backup/etc/module.xml index f43decfdbd42c..80d19293753e8 100644 --- a/app/code/Magento/Backup/etc/module.xml +++ b/app/code/Magento/Backup/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Catalog/Setup/InstallData.php b/app/code/Magento/Catalog/Setup/InstallData.php index 3f18ed575e087..e77013106a237 100644 --- a/app/code/Magento/Catalog/Setup/InstallData.php +++ b/app/code/Magento/Catalog/Setup/InstallData.php @@ -301,5 +301,17 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface '1' ); } + $categorySetup->updateAttribute( + \Magento\Catalog\Model\Category::ENTITY, + 'custom_design_from', + 'attribute_model', + 'Magento\Catalog\Model\Resource\Eav\Attribute' + ); + $categorySetup->updateAttribute( + \Magento\Catalog\Model\Category::ENTITY, + 'custom_design_from', + 'frontend_model', + 'Magento\Eav\Model\Entity\Attribute\Frontend\Datetime' + ); } } diff --git a/app/code/Magento/Catalog/Setup/InstallSchema.php b/app/code/Magento/Catalog/Setup/InstallSchema.php index 833ea7cf4dbbd..adc00706d7079 100644 --- a/app/code/Magento/Catalog/Setup/InstallSchema.php +++ b/app/code/Magento/Catalog/Setup/InstallSchema.php @@ -37,13 +37,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Entity ID' ) - ->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type ID' - ) ->addColumn( 'attribute_set_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -93,10 +86,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Update Time' ) - ->addIndex( - $installer->getIdxName('catalog_product_entity', ['entity_type_id']), - ['entity_type_id'] - ) ->addIndex( $installer->getIdxName('catalog_product_entity', ['attribute_set_id']), ['attribute_set_id'] @@ -117,13 +106,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con 'attribute_set_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) - ->addForeignKey( - $installer->getFkName('catalog_product_entity', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), - 'entity_type_id', - $installer->getTable('eav_entity_type'), - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - ) ->setComment('Catalog Product Table'); $installer->getConnection()->createTable($table); @@ -139,13 +121,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['identity' => true, 'nullable' => false, 'primary' => true], 'Value ID' ) - ->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type ID' - ) ->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -237,13 +212,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['identity' => true, 'nullable' => false, 'primary' => true], 'Value ID' ) - ->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type ID' - ) ->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -335,13 +303,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['identity' => true, 'nullable' => false, 'primary' => true], 'Value ID' ) - ->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type ID' - ) ->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -423,13 +384,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['identity' => true, 'nullable' => false, 'primary' => true], 'Value ID' ) - ->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type ID' - ) ->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -521,13 +475,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['identity' => true, 'nullable' => false, 'primary' => true], 'Value ID' ) - ->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type ID' - ) ->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -619,13 +566,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['identity' => true, 'nullable' => false, 'primary' => true], 'Value ID' ) - ->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type ID' - ) ->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -664,10 +604,10 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ->addIndex( $installer->getIdxName( 'catalog_product_entity_gallery', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['entity_id', 'attribute_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['entity_id', 'attribute_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] ) ->addIndex( @@ -728,13 +668,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Entity ID' ) - ->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type ID' - ) ->addColumn( 'attribute_set_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -810,13 +743,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['identity' => true, 'nullable' => false, 'primary' => true], 'Value ID' ) - ->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type ID' - ) ->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -848,10 +774,10 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ->addIndex( $installer->getIdxName( 'catalog_category_entity_datetime', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['entity_id', 'attribute_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['entity_id', 'attribute_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] ) ->addIndex( @@ -912,13 +838,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['identity' => true, 'nullable' => false, 'primary' => true], 'Value ID' ) - ->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type ID' - ) ->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -950,10 +869,10 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ->addIndex( $installer->getIdxName( 'catalog_category_entity_decimal', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + [ 'entity_id', 'attribute_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['entity_id', 'attribute_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] ) ->addIndex( @@ -1014,13 +933,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['identity' => true, 'nullable' => false, 'primary' => true], 'Value ID' ) - ->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type ID' - ) ->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -1052,10 +964,10 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ->addIndex( $installer->getIdxName( 'catalog_category_entity_int', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['entity_id', 'attribute_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['entity_id', 'attribute_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] ) ->addIndex( @@ -1111,13 +1023,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['identity' => true, 'nullable' => false, 'primary' => true], 'Value ID' ) - ->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type ID' - ) ->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -1149,10 +1054,10 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ->addIndex( $installer->getIdxName( 'catalog_category_entity_text', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['entity_id', 'attribute_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['entity_id', 'attribute_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] ) ->addIndex( @@ -1208,13 +1113,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ['identity' => true, 'nullable' => false, 'primary' => true], 'Value ID' ) - ->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type ID' - ) ->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -1246,10 +1144,10 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ->addIndex( $installer->getIdxName( 'catalog_category_entity_varchar', - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['entity_id', 'attribute_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE ), - ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['entity_id', 'attribute_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] ) ->addIndex( @@ -4659,7 +4557,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ); $installer->getConnection() ->createTable($table); - $installer->endSetup(); } diff --git a/app/code/Magento/Catalog/Setup/UpgradeData.php b/app/code/Magento/Catalog/Setup/UpgradeData.php deleted file mode 100644 index 1459f4a31d681..0000000000000 --- a/app/code/Magento/Catalog/Setup/UpgradeData.php +++ /dev/null @@ -1,56 +0,0 @@ -category = $category; - } - - /** - * {@inheritdoc} - */ - public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) - { - if (version_compare($context->getVersion(), '2.0.0.2') < 0) { - $newBackendModel = 'Magento\Catalog\Model\Attribute\Backend\Startdate'; - $connection = $setup->getConnection(); - $connection->startSetup(); - $connection->update( - $setup->getTable('eav_attribute'), - ['backend_model' => $newBackendModel], - ['backend_model = ?' => 'Magento\Catalog\Model\Product\Attribute\Backend\Startdate'] - ); - /** @var \Magento\Catalog\Model\Resource\Eav\Attribute $attribute */ - foreach ($this->category->getAttributes() as $attribute) { - if ($attribute->getAttributeCode() == 'custom_design_from') { - $attribute->setBackendModel($newBackendModel); - $attribute->save(); - break; - } - } - $connection->endSetup(); - } - } -} diff --git a/app/code/Magento/Catalog/Setup/UpgradeSchema.php b/app/code/Magento/Catalog/Setup/UpgradeSchema.php deleted file mode 100644 index 2f37f84191ac2..0000000000000 --- a/app/code/Magento/Catalog/Setup/UpgradeSchema.php +++ /dev/null @@ -1,105 +0,0 @@ -getVersion(), '2.0.0.1') < 0) { - $installer = $setup; - - $installer->startSetup(); - - $connection = $installer->getConnection(); - $connection->dropForeignKey( - $installer->getTable('catalog_product_entity'), - 'FK_CAT_PRD_ENTT_ENTT_TYPE_ID_EAV_ENTT_TYPE_ENTT_TYPE_ID' - ); - - $dropTablesColumn = [ - 'catalog_product_entity', - 'catalog_product_entity_datetime', - 'catalog_product_entity_decimal', - 'catalog_product_entity_gallery', - 'catalog_product_entity_int', - 'catalog_product_entity_text', - 'catalog_product_entity_varchar', - 'catalog_category_entity', - 'catalog_category_entity_datetime', - 'catalog_category_entity_decimal', - 'catalog_category_entity_int', - 'catalog_category_entity_text', - 'catalog_category_entity_varchar' - ]; - foreach ($dropTablesColumn as $table) { - $connection->dropIndex( - $installer->getTable($table), - $installer->getIdxName( - $table, - 'entity_type_id', - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX - ) - ); - $connection->dropColumn($installer->getTable($table), 'entity_type_id'); - } - - $installer->endSetup(); - } - - if (version_compare($context->getVersion(), '2.0.0.3') < 0) { - $setup->startSetup(); - - $connection = $setup->getConnection(); - $connection->addColumn( - $setup->getTable('catalog_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' - ] - ); - $connection->addColumn( - $setup->getTable('catalog_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' - ] - ); - $connection->addColumn( - $setup->getTable('catalog_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->endSetup(); - } - } -} diff --git a/app/code/Magento/Catalog/etc/module.xml b/app/code/Magento/Catalog/etc/module.xml index 93ec513556e08..ed2f204b24e5c 100644 --- a/app/code/Magento/Catalog/etc/module.xml +++ b/app/code/Magento/Catalog/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/CatalogSearch/Setup/InstallSchema.php b/app/code/Magento/CatalogSearch/Setup/InstallSchema.php index b9e718318b7ef..e5e2bf8f91ca5 100644 --- a/app/code/Magento/CatalogSearch/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogSearch/Setup/InstallSchema.php @@ -21,68 +21,7 @@ class InstallSchema implements InstallSchemaInterface public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; - $installer->startSetup(); - - /** - * Create table 'catalogsearch_fulltext' - */ - $table = $installer->getConnection() - ->newTable($installer->getTable('catalogsearch_fulltext')) - ->addColumn( - 'fulltext_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Entity ID' - ) - ->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false], - 'Product ID' - ) - ->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store ID' - ) - ->addColumn( - 'data_index', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '4g', - [], - 'Data index' - ) - ->addIndex( - $installer->getIdxName( - 'catalogsearch_fulltext', - ['product_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['product_id', 'store_id'], - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - ) - ->addIndex( - $installer->getIdxName( - 'catalogsearch_fulltext', - 'data_index', - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_FULLTEXT - ), - 'data_index', - ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_FULLTEXT] - ) - ->setOption( - 'type', - 'InnoDB' - ) - ->setComment('Catalog search result table'); - - $installer->getConnection()->createTable($table); - $installer->getConnection()->addColumn( $installer->getTable('catalog_eav_attribute'), 'search_weight', @@ -94,8 +33,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con 'comment' => 'Search Weight' ] ); - $installer->endSetup(); - } } diff --git a/app/code/Magento/CatalogSearch/Setup/UpgradeSchema.php b/app/code/Magento/CatalogSearch/Setup/UpgradeSchema.php deleted file mode 100644 index bd950bd1f8266..0000000000000 --- a/app/code/Magento/CatalogSearch/Setup/UpgradeSchema.php +++ /dev/null @@ -1,74 +0,0 @@ -getConnection(); - if (version_compare($context->getVersion(), '2.0.1') < 0) { - $connection->dropTable($installer->getTable('catalogsearch_fulltext')); - $table = $connection->newTable($installer->getTable('catalogsearch_fulltext_index_default')) - ->addColumn( - 'FTS_DOC_ID', - Table::TYPE_BIGINT, - null, - ['unsigned' => true, 'nullable' => false, 'auto_increment' => true, 'primary' => true], - 'Entity ID' - )->addColumn( - 'product_id', - Table::TYPE_INTEGER, - 10, - ['unsigned' => true, 'nullable' => false], - 'Product ID' - )->addColumn( - 'attribute_id', - Table::TYPE_INTEGER, - 10, - ['unsigned' => true, 'nullable' => false] - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false], - 'Store ID' - )->addColumn( - 'data_index', - Table::TYPE_TEXT, - '4g', - ['nullable' => true], - 'Data index' - )->addIndex( - 'FTI_CATALOGSEARCH_FULLTEXT_DATA_INDEX', - ['data_index'], - ['type' => AdapterInterface::INDEX_TYPE_FULLTEXT] - ); - $connection->createTable($table); - } - if (version_compare($context->getVersion(), '2.0.2') < 0) { - $connection->dropTable('catalogsearch_fulltext_index_default'); - } - } -} diff --git a/app/code/Magento/CatalogSearch/etc/module.xml b/app/code/Magento/CatalogSearch/etc/module.xml index 64e6b45ef808e..269b6462350b0 100644 --- a/app/code/Magento/CatalogSearch/etc/module.xml +++ b/app/code/Magento/CatalogSearch/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Cms/Setup/InstallSchema.php b/app/code/Magento/Cms/Setup/InstallSchema.php index 00c2eba7289fe..de6853122eba7 100644 --- a/app/code/Magento/Cms/Setup/InstallSchema.php +++ b/app/code/Magento/Cms/Setup/InstallSchema.php @@ -9,6 +9,7 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\SchemaSetupInterface; +use Magento\Framework\DB\Adapter\AdapterInterface; /** * @codeCoverageIgnore @@ -272,7 +273,26 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ); $installer->getConnection()->createTable($table); + $installer->getConnection()->addIndex( + $installer->getTable('cms_page'), + $setup->getIdxName( + $installer->getTable('cms_page'), + ['title', 'meta_keywords', 'meta_description', 'identifier', 'content'], + AdapterInterface::INDEX_TYPE_FULLTEXT + ), + ['title', 'meta_keywords', 'meta_description', 'identifier', 'content'], + AdapterInterface::INDEX_TYPE_FULLTEXT + ); + $installer->getConnection()->addIndex( + $installer->getTable('cms_block'), + $setup->getIdxName( + $installer->getTable('cms_block'), + ['title', 'identifier', 'content'], + AdapterInterface::INDEX_TYPE_FULLTEXT + ), + ['title', 'identifier', 'content'], + AdapterInterface::INDEX_TYPE_FULLTEXT + ); $installer->endSetup(); - } } diff --git a/app/code/Magento/Cms/Setup/UpgradeSchema.php b/app/code/Magento/Cms/Setup/UpgradeSchema.php deleted file mode 100644 index a4811055a0796..0000000000000 --- a/app/code/Magento/Cms/Setup/UpgradeSchema.php +++ /dev/null @@ -1,52 +0,0 @@ -getConnection(); - if (version_compare($context->getVersion(), '2.0.1') < 0) { - $connection->addIndex( - $installer->getTable('cms_page'), - $setup->getIdxName( - $installer->getTable('cms_page'), - ['title', 'meta_keywords', 'meta_description', 'identifier', 'content'], - AdapterInterface::INDEX_TYPE_FULLTEXT - ), - ['title', 'meta_keywords', 'meta_description', 'identifier', 'content'], - AdapterInterface::INDEX_TYPE_FULLTEXT - ); - $connection->addIndex( - $installer->getTable('cms_block'), - $setup->getIdxName( - $installer->getTable('cms_block'), - ['title', 'identifier', 'content'], - AdapterInterface::INDEX_TYPE_FULLTEXT - ), - ['title', 'identifier', 'content'], - AdapterInterface::INDEX_TYPE_FULLTEXT - ); - } - } -} diff --git a/app/code/Magento/Cms/etc/module.xml b/app/code/Magento/Cms/etc/module.xml index 4303db7c6ae4c..9103575c3a6b1 100644 --- a/app/code/Magento/Cms/etc/module.xml +++ b/app/code/Magento/Cms/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/ConfigurableProduct/etc/module.xml b/app/code/Magento/ConfigurableProduct/etc/module.xml index 22393b16759b2..193c0adb48ca3 100644 --- a/app/code/Magento/ConfigurableProduct/etc/module.xml +++ b/app/code/Magento/ConfigurableProduct/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/CurrencySymbol/etc/module.xml b/app/code/Magento/CurrencySymbol/etc/module.xml index 30fab952ed73f..97cf5f60eefb3 100644 --- a/app/code/Magento/CurrencySymbol/etc/module.xml +++ b/app/code/Magento/CurrencySymbol/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Customer/Setup/InstallSchema.php b/app/code/Magento/Customer/Setup/InstallSchema.php index fc3458c5fdc5d..a96527bb98073 100644 --- a/app/code/Magento/Customer/Setup/InstallSchema.php +++ b/app/code/Magento/Customer/Setup/InstallSchema.php @@ -35,18 +35,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Entity Id' - )->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type Id' - )->addColumn( - 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Set Id' )->addColumn( 'website_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -192,9 +180,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addIndex( $installer->getIdxName('customer_entity', ['store_id']), ['store_id'] - )->addIndex( - $installer->getIdxName('customer_entity', ['entity_type_id']), - ['entity_type_id'] )->addIndex( $installer->getIdxName( 'customer_entity', @@ -240,18 +225,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Entity Id' - )->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type Id' - )->addColumn( - 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Attribute Set Id' )->addColumn( 'increment_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, @@ -422,12 +395,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Value Id' - )->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type Id' )->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -454,9 +421,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ), ['entity_id', 'attribute_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('customer_address_entity_datetime', ['entity_type_id']), - ['entity_type_id'] )->addIndex( $installer->getIdxName('customer_address_entity_datetime', ['attribute_id']), ['attribute_id'] @@ -480,17 +444,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->getTable('customer_address_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName( - 'customer_address_entity_datetime', - 'entity_type_id', - 'eav_entity_type', - 'entity_type_id' - ), - 'entity_type_id', - $installer->getTable('eav_entity_type'), - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Address Entity Datetime' ); @@ -507,12 +460,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Value Id' - )->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type Id' )->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -539,9 +486,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ), ['entity_id', 'attribute_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('customer_address_entity_decimal', ['entity_type_id']), - ['entity_type_id'] )->addIndex( $installer->getIdxName('customer_address_entity_decimal', ['attribute_id']), ['attribute_id'] @@ -565,17 +509,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->getTable('customer_address_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName( - 'customer_address_entity_decimal', - 'entity_type_id', - 'eav_entity_type', - 'entity_type_id' - ), - 'entity_type_id', - $installer->getTable('eav_entity_type'), - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Address Entity Decimal' ); @@ -592,12 +525,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Value Id' - )->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type Id' )->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -624,9 +551,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ), ['entity_id', 'attribute_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('customer_address_entity_int', ['entity_type_id']), - ['entity_type_id'] )->addIndex( $installer->getIdxName('customer_address_entity_int', ['attribute_id']), ['attribute_id'] @@ -645,12 +569,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->getTable('customer_address_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_address_entity_int', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), - 'entity_type_id', - $installer->getTable('eav_entity_type'), - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Address Entity Int' ); @@ -667,12 +585,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Value Id' - )->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type Id' )->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -699,9 +611,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ), ['entity_id', 'attribute_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('customer_address_entity_text', ['entity_type_id']), - ['entity_type_id'] )->addIndex( $installer->getIdxName('customer_address_entity_text', ['attribute_id']), ['attribute_id'] @@ -717,17 +626,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->getTable('customer_address_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName( - 'customer_address_entity_text', - 'entity_type_id', - 'eav_entity_type', - 'entity_type_id' - ), - 'entity_type_id', - $installer->getTable('eav_entity_type'), - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Address Entity Text' ); @@ -744,12 +642,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Value Id' - )->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type Id' )->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -776,9 +668,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ), ['entity_id', 'attribute_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('customer_address_entity_varchar', ['entity_type_id']), - ['entity_type_id'] )->addIndex( $installer->getIdxName('customer_address_entity_varchar', ['attribute_id']), ['attribute_id'] @@ -802,17 +691,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->getTable('customer_address_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName( - 'customer_address_entity_varchar', - 'entity_type_id', - 'eav_entity_type', - 'entity_type_id' - ), - 'entity_type_id', - $installer->getTable('eav_entity_type'), - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Address Entity Varchar' ); @@ -829,12 +707,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Value Id' - )->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type Id' )->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -861,9 +733,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ), ['entity_id', 'attribute_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('customer_entity_datetime', ['entity_type_id']), - ['entity_type_id'] )->addIndex( $installer->getIdxName('customer_entity_datetime', ['attribute_id']), ['attribute_id'] @@ -882,12 +751,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->getTable('customer_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_entity_datetime', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), - 'entity_type_id', - $installer->getTable('eav_entity_type'), - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Entity Datetime' ); @@ -904,12 +767,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Value Id' - )->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type Id' )->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -936,9 +793,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ), ['entity_id', 'attribute_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('customer_entity_decimal', ['entity_type_id']), - ['entity_type_id'] )->addIndex( $installer->getIdxName('customer_entity_decimal', ['attribute_id']), ['attribute_id'] @@ -957,12 +811,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->getTable('customer_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_entity_decimal', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), - 'entity_type_id', - $installer->getTable('eav_entity_type'), - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Entity Decimal' ); @@ -979,12 +827,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Value Id' - )->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type Id' )->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -1011,9 +853,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ), ['entity_id', 'attribute_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('customer_entity_int', ['entity_type_id']), - ['entity_type_id'] )->addIndex( $installer->getIdxName('customer_entity_int', ['attribute_id']), ['attribute_id'] @@ -1032,12 +871,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->getTable('customer_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_entity_int', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), - 'entity_type_id', - $installer->getTable('eav_entity_type'), - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Entity Int' ); @@ -1054,12 +887,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Value Id' - )->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type Id' )->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -1086,9 +913,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ), ['entity_id', 'attribute_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('customer_entity_text', ['entity_type_id']), - ['entity_type_id'] )->addIndex( $installer->getIdxName('customer_entity_text', ['attribute_id']), ['attribute_id'] @@ -1104,12 +928,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->getTable('customer_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_entity_text', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), - 'entity_type_id', - $installer->getTable('eav_entity_type'), - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Entity Text' ); @@ -1126,12 +944,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['identity' => true, 'nullable' => false, 'primary' => true], 'Value Id' - )->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Entity Type Id' )->addColumn( 'attribute_id', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -1158,9 +970,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ), ['entity_id', 'attribute_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] - )->addIndex( - $installer->getIdxName('customer_entity_varchar', ['entity_type_id']), - ['entity_type_id'] )->addIndex( $installer->getIdxName('customer_entity_varchar', ['attribute_id']), ['attribute_id'] @@ -1179,12 +988,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->getTable('customer_entity'), 'entity_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->addForeignKey( - $installer->getFkName('customer_entity_varchar', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), - 'entity_type_id', - $installer->getTable('eav_entity_type'), - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Entity Varchar' ); @@ -1385,6 +1188,12 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], 'Visitor ID' + )->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Customer Id' )->addColumn( 'session_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, @@ -1397,11 +1206,72 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['nullable' => false], 'Last Visit Time' + )->addIndex( + $installer->getIdxName('customer_visitor', ['customer_id']), + ['customer_id'] )->setComment( 'Visitor Table' ); $installer->getConnection()->createTable($table); + $table = $installer->getConnection() + ->newTable( + $installer->getTable('customer_log') + ) + ->addColumn( + 'log_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [ + 'nullable' => false, + 'identity' => true, + 'primary' => true + ], + 'Log ID' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [ + 'nullable' => false + ], + 'Customer ID' + ) + ->addColumn( + 'last_login_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [ + 'nullable' => true, + 'default' => null + ], + 'Last Login Time' + ) + ->addColumn( + 'last_logout_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [ + 'nullable' => true, + 'default' => null + ], + 'Last Logout Time' + ) + ->addIndex( + $installer->getIdxName( + $installer->getTable('customer_log'), + ['customer_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['customer_id'], + [ + 'type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ] + ) + ->setComment('Customer Log Table'); + $installer->getConnection()->createTable($table); + $installer->endSetup(); } diff --git a/app/code/Magento/Customer/Setup/UpgradeSchema.php b/app/code/Magento/Customer/Setup/UpgradeSchema.php deleted file mode 100644 index 1094a6d1d3d4e..0000000000000 --- a/app/code/Magento/Customer/Setup/UpgradeSchema.php +++ /dev/null @@ -1,156 +0,0 @@ -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(); - } -} diff --git a/app/code/Magento/Customer/etc/module.xml b/app/code/Magento/Customer/etc/module.xml index 973c14db73d61..3b30bbb644142 100644 --- a/app/code/Magento/Customer/etc/module.xml +++ b/app/code/Magento/Customer/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/ImportExport/Setup/InstallSchema.php b/app/code/Magento/ImportExport/Setup/InstallSchema.php index beb4abc065cc1..3e85a986899c9 100644 --- a/app/code/Magento/ImportExport/Setup/InstallSchema.php +++ b/app/code/Magento/ImportExport/Setup/InstallSchema.php @@ -59,6 +59,56 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con ->setComment('Import Data Table'); $installer->getConnection()->createTable($table); + /** + * Create 'import_history' table. + */ + $table = $installer->getConnection() + ->newTable($installer->getTable('import_history')) + ->addColumn( + 'history_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'History record Id' + ) + ->addColumn( + 'started_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], + 'Started at' + ) + ->addColumn( + 'user_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'User ID' + ) + ->addColumn( + 'imported_file', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Imported file' + ) + ->addColumn( + 'execution_time', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Execution time' + ) + ->addColumn( + 'summary', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Summary' + ) + ->setComment('Import history table'); + $installer->getConnection()->createTable($table); + $installer->endSetup(); } diff --git a/app/code/Magento/ImportExport/Setup/UpgradeSchema.php b/app/code/Magento/ImportExport/Setup/UpgradeSchema.php deleted file mode 100644 index 900c2ed39be6b..0000000000000 --- a/app/code/Magento/ImportExport/Setup/UpgradeSchema.php +++ /dev/null @@ -1,85 +0,0 @@ -startSetup(); - - if (version_compare($context->getVersion(), '2.0.0.1') < 0) { - /** - * Create 'import_history' table. - */ - $table = $setup->getConnection() - ->newTable($setup->getTable('import_history')) - ->addColumn( - 'history_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'History record Id' - ) - ->addColumn( - 'started_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], - 'Started at' - ) - ->addColumn( - 'user_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'User ID' - ) - ->addColumn( - 'imported_file', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Imported file' - ) - ->addColumn( - 'execution_time', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Execution time' - ) - ->addColumn( - 'summary', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => true], - 'Summary' - ) - ->setComment('Import history table'); - - $setup->getConnection()->createTable($table); - } - - $setup->endSetup(); - } -} diff --git a/app/code/Magento/ImportExport/etc/module.xml b/app/code/Magento/ImportExport/etc/module.xml index e072148a1dd4b..4dad36db35038 100644 --- a/app/code/Magento/ImportExport/etc/module.xml +++ b/app/code/Magento/ImportExport/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/Indexer/Setup/UpgradeData.php b/app/code/Magento/Indexer/Setup/InstallData.php similarity index 62% rename from app/code/Magento/Indexer/Setup/UpgradeData.php rename to app/code/Magento/Indexer/Setup/InstallData.php index 880e8c26413a7..c2fbcace85baa 100644 --- a/app/code/Magento/Indexer/Setup/UpgradeData.php +++ b/app/code/Magento/Indexer/Setup/InstallData.php @@ -9,19 +9,19 @@ use Magento\Framework\Encryption\Encryptor; use Magento\Framework\Encryption\EncryptorInterface; use Magento\Framework\Json\EncoderInterface; -use Magento\Framework\Setup\UpgradeDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Indexer\Model\ConfigInterface; use Magento\Indexer\Model\Resource\Indexer\State\CollectionFactory; use Magento\Indexer\Model\Indexer\State; use Magento\Indexer\Model\Indexer\StateFactory; +use Magento\Framework\Setup\InstallDataInterface; /** * @codeCoverageIgnore * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class UpgradeData implements UpgradeDataInterface +class InstallData implements InstallDataInterface { /** * Indexer collection factory @@ -80,30 +80,28 @@ public function __construct( * @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { - if (version_compare($context->getVersion(), '2.0.1') < 0) { - /** @var State[] $stateIndexers */ - $stateIndexers = []; - $states = $this->statesFactory->create(); - foreach ($states->getItems() as $state) { - /** @var State $state */ - $stateIndexers[$state->getIndexerId()] = $state; - } + /** @var State[] $stateIndexers */ + $stateIndexers = []; + $states = $this->statesFactory->create(); + foreach ($states->getItems() as $state) { + /** @var State $state */ + $stateIndexers[$state->getIndexerId()] = $state; + } - foreach ($this->config->getIndexers() as $indexerId => $indexerConfig) { - $hash = $this->encryptor->hash($this->encoder->encode($indexerConfig), Encryptor::HASH_VERSION_MD5); - if (isset($stateIndexers[$indexerId])) { - $stateIndexers[$indexerId]->setHashConfig($hash); - $stateIndexers[$indexerId]->save(); - } else { - /** @var State $state */ - $state = $this->stateFactory->create(); - $state->loadByIndexer($indexerId); - $state->setHashConfig($hash); - $state->setStatus(State::STATUS_INVALID); - $state->save(); - } + foreach ($this->config->getIndexers() as $indexerId => $indexerConfig) { + $hash = $this->encryptor->hash($this->encoder->encode($indexerConfig), Encryptor::HASH_VERSION_MD5); + if (isset($stateIndexers[$indexerId])) { + $stateIndexers[$indexerId]->setHashConfig($hash); + $stateIndexers[$indexerId]->save(); + } else { + /** @var State $state */ + $state = $this->stateFactory->create(); + $state->loadByIndexer($indexerId); + $state->setHashConfig($hash); + $state->setStatus(State::STATUS_INVALID); + $state->save(); } } } diff --git a/app/code/Magento/Indexer/Setup/InstallSchema.php b/app/code/Magento/Indexer/Setup/InstallSchema.php index a3cc46c6e022a..44fbe6f37fe80 100644 --- a/app/code/Magento/Indexer/Setup/InstallSchema.php +++ b/app/code/Magento/Indexer/Setup/InstallSchema.php @@ -58,6 +58,13 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con [], 'Indexer Status' ) + ->addColumn( + 'hash_config', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'Hash of indexer config' + ) ->addIndex( $installer->getIdxName('indexer_state', ['indexer_id']), ['indexer_id'] diff --git a/app/code/Magento/Indexer/Setup/Recurring.php b/app/code/Magento/Indexer/Setup/Recurring.php index da4e6f2932df0..e453e18bc7d9f 100644 --- a/app/code/Magento/Indexer/Setup/Recurring.php +++ b/app/code/Magento/Indexer/Setup/Recurring.php @@ -78,35 +78,33 @@ public function __construct( */ public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { - if (version_compare($context->getVersion(), '2.0.1') >= 0) { - /** @var State[] $stateIndexers */ - $stateIndexers = []; - $states = $this->statesFactory->create(); - foreach ($states->getItems() as $state) { - /** @var State $state */ - $stateIndexers[$state->getIndexerId()] = $state; - } + /** @var State[] $stateIndexers */ + $stateIndexers = []; + $states = $this->statesFactory->create(); + foreach ($states->getItems() as $state) { + /** @var State $state */ + $stateIndexers[$state->getIndexerId()] = $state; + } - foreach ($this->config->getIndexers() as $indexerId => $indexerConfig) { - $expectedHashConfig = $this->encryptor->hash( - $this->encoder->encode($indexerConfig), - Encryptor::HASH_VERSION_MD5 - ); + foreach ($this->config->getIndexers() as $indexerId => $indexerConfig) { + $expectedHashConfig = $this->encryptor->hash( + $this->encoder->encode($indexerConfig), + Encryptor::HASH_VERSION_MD5 + ); - if (isset($stateIndexers[$indexerId])) { - if ($stateIndexers[$indexerId]->getHashConfig() != $expectedHashConfig) { - $stateIndexers[$indexerId]->setStatus(State::STATUS_INVALID); - $stateIndexers[$indexerId]->setHashConfig($expectedHashConfig); - $stateIndexers[$indexerId]->save(); - } - } else { - /** @var State $state */ - $state = $this->stateFactory->create(); - $state->loadByIndexer($indexerId); - $state->setHashConfig($expectedHashConfig); - $state->setStatus(State::STATUS_INVALID); - $state->save(); + if (isset($stateIndexers[$indexerId])) { + if ($stateIndexers[$indexerId]->getHashConfig() != $expectedHashConfig) { + $stateIndexers[$indexerId]->setStatus(State::STATUS_INVALID); + $stateIndexers[$indexerId]->setHashConfig($expectedHashConfig); + $stateIndexers[$indexerId]->save(); } + } else { + /** @var State $state */ + $state = $this->stateFactory->create(); + $state->loadByIndexer($indexerId); + $state->setHashConfig($expectedHashConfig); + $state->setStatus(State::STATUS_INVALID); + $state->save(); } } } diff --git a/app/code/Magento/Indexer/Setup/UpgradeSchema.php b/app/code/Magento/Indexer/Setup/UpgradeSchema.php deleted file mode 100644 index 2288e2963d3df..0000000000000 --- a/app/code/Magento/Indexer/Setup/UpgradeSchema.php +++ /dev/null @@ -1,46 +0,0 @@ -getConnection(); - if (version_compare($context->getVersion(), '2.0.1') < 0) { - /** - * Add hash column of indexer_state table. - */ - $table = $setup->getTable('indexer_state'); - $connection->addColumn( - $table, - 'hash_config', - [ - 'type' => Table::TYPE_TEXT, - 'length' => 32, - 'nullable' => false, - 'comment' => 'Hash of indexer config', - ] - ); - } - } -} diff --git a/app/code/Magento/Indexer/etc/module.xml b/app/code/Magento/Indexer/etc/module.xml index 2edd82416ca5f..3eb6e8433c1ce 100644 --- a/app/code/Magento/Indexer/etc/module.xml +++ b/app/code/Magento/Indexer/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Multishipping/etc/module.xml b/app/code/Magento/Multishipping/etc/module.xml index b6ea0b6ce80ca..1e60e1c6f7c73 100644 --- a/app/code/Magento/Multishipping/etc/module.xml +++ b/app/code/Magento/Multishipping/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/PageCache/etc/module.xml b/app/code/Magento/PageCache/etc/module.xml index bd152d0a9e584..8a461081663b3 100644 --- a/app/code/Magento/PageCache/etc/module.xml +++ b/app/code/Magento/PageCache/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/RequireJs/etc/module.xml b/app/code/Magento/RequireJs/etc/module.xml index 05927da66756a..e9545774fa3ab 100644 --- a/app/code/Magento/RequireJs/etc/module.xml +++ b/app/code/Magento/RequireJs/etc/module.xml @@ -6,5 +6,5 @@ */ --> - + diff --git a/app/code/Magento/Sales/Setup/InstallSchema.php b/app/code/Magento/Sales/Setup/InstallSchema.php index afa4460d56fa6..8e44a50adf155 100644 --- a/app/code/Magento/Sales/Setup/InstallSchema.php +++ b/app/code/Magento/Sales/Setup/InstallSchema.php @@ -473,6 +473,12 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['unsigned' => true], 'Email Sent' + )->addColumn( + 'send_email', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Send Email' )->addColumn( 'forced_shipment_with_invoice', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -759,7 +765,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con 'updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], 'Updated At' )->addColumn( 'total_item_count', @@ -851,10 +857,10 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addIndex( $installer->getIdxName( 'sales_order', - ['increment_id'], + ['increment_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE ), - ['increment_id'], + ['increment_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( $installer->getIdxName('sales_order', ['created_at']), @@ -871,6 +877,12 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addIndex( $installer->getIdxName('sales_order', ['updated_at']), ['updated_at'] + )->addIndex( + $installer->getIdxName('sales_order', ['send_email']), + ['send_email'] + )->addIndex( + $installer->getIdxName('sales_order', ['email_sent']), + ['email_sent'] )->addForeignKey( $installer->getFkName('sales_order', 'customer_id', 'customer_entity', 'entity_id'), 'customer_id', @@ -1070,10 +1082,10 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addIndex( $installer->getIdxName( 'sales_order_grid', - ['increment_id'], + ['increment_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE ), - ['increment_id'], + ['increment_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( $installer->getIdxName('sales_order_grid', ['shipping_name']), @@ -1309,7 +1321,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - [], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At' )->addColumn( 'entity_name', @@ -2149,6 +2161,12 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['unsigned' => true], 'Email Sent' + )->addColumn( + 'send_email', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Send Email' )->addColumn( 'order_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -2189,13 +2207,13 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - [], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At' )->addColumn( 'updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - [], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], 'Updated At' )->addColumn( 'packages', @@ -2209,6 +2227,18 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con '2m', [], 'Shipping Label Content' + )->addColumn( + 'customer_note', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + null, + [], + 'Customer Note' + )->addColumn( + 'customer_note_notify', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Customer Note Notify' )->addIndex( $installer->getIdxName('sales_shipment', ['store_id']), ['store_id'] @@ -2218,10 +2248,10 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addIndex( $installer->getIdxName( 'sales_shipment', - ['increment_id'], + ['increment_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE ), - ['increment_id'], + ['increment_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( $installer->getIdxName('sales_shipment', ['order_id']), @@ -2232,6 +2262,12 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addIndex( $installer->getIdxName('sales_shipment', ['updated_at']), ['updated_at'] + )->addIndex( + $installer->getIdxName('sales_shipment', ['send_email']), + ['send_email'] + )->addIndex( + $installer->getIdxName('sales_shipment', ['email_sent']), + ['email_sent'] )->addForeignKey( $installer->getFkName('sales_shipment', 'order_id', 'sales_order', 'entity_id'), 'order_id', @@ -2420,6 +2456,9 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addIndex( $installer->getIdxName('sales_shipment_grid', ['created_at']), ['created_at'] + )->addIndex( + $installer->getIdxName('sales_shipment_grid', ['updated_at']), + ['updated_at'] )->addIndex( $installer->getIdxName('sales_shipment_grid', ['order_created_at']), ['order_created_at'] @@ -2612,13 +2651,13 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - [], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At' )->addColumn( 'updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - [], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], 'Updated At' )->addIndex( $installer->getIdxName('sales_shipment_track', ['parent_id']), @@ -2679,7 +2718,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - [], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At' )->addIndex( $installer->getIdxName('sales_shipment_comment', ['created_at']), @@ -2853,6 +2892,12 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['unsigned' => true], 'Email Sent' + )->addColumn( + 'send_email', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Send Email' )->addColumn( 'can_void_flag', \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, @@ -2911,13 +2956,13 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - [], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At' )->addColumn( 'updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - [], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], 'Updated At' )->addColumn( 'discount_tax_compensation_amount', @@ -2967,6 +3012,18 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con 255, [], 'Discount Description' + )->addColumn( + 'customer_note', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + null, + [], + 'Customer Note' + )->addColumn( + 'customer_note_notify', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Customer Note Notify' )->addIndex( $installer->getIdxName('sales_invoice', ['store_id']), ['store_id'] @@ -2982,14 +3039,23 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addIndex( $installer->getIdxName( 'sales_invoice', - ['increment_id'], + ['increment_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE ), - ['increment_id'], + ['increment_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( $installer->getIdxName('sales_invoice', ['created_at']), ['created_at'] + )->addIndex( + $installer->getIdxName('sales_invoice', ['updated_at']), + ['updated_at'] + )->addIndex( + $installer->getIdxName('sales_invoice', ['send_email']), + ['send_email'] + )->addIndex( + $installer->getIdxName('sales_invoice', ['email_sent']), + ['email_sent'] )->addForeignKey( $installer->getFkName('sales_invoice', 'order_id', 'sales_order', 'entity_id'), 'order_id', @@ -3156,6 +3222,12 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, [], 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Updated At' )->addIndex( $installer->getIdxName('sales_invoice_grid', ['store_id']), ['store_id'] @@ -3182,6 +3254,9 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addIndex( $installer->getIdxName('sales_invoice_grid', ['created_at']), ['created_at'] + )->addIndex( + $installer->getIdxName('sales_invoice_grid', ['updated_at']), + ['updated_at'] )->addIndex( $installer->getIdxName('sales_invoice_grid', ['order_created_at']), ['order_created_at'] @@ -3425,7 +3500,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - [], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At' )->addIndex( $installer->getIdxName('sales_invoice_comment', ['created_at']), @@ -3617,6 +3692,12 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, ['unsigned' => true], 'Email Sent' + )->addColumn( + 'send_email', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Send Email' )->addColumn( 'creditmemo_status', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -3687,13 +3768,13 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - [], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At' )->addColumn( 'updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - [], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], 'Updated At' )->addColumn( 'discount_tax_compensation_amount', @@ -3737,6 +3818,18 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con 255, [], 'Discount Description' + )->addColumn( + 'customer_note', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + null, + [], + 'Customer Note' + )->addColumn( + 'customer_note_notify', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Customer Note Notify' )->addIndex( $installer->getIdxName('sales_creditmemo', ['store_id']), ['store_id'] @@ -3749,10 +3842,10 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addIndex( $installer->getIdxName( 'sales_creditmemo', - ['increment_id'], + ['increment_id', 'store_id'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE ), - ['increment_id'], + ['increment_id', 'store_id'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->addIndex( $installer->getIdxName('sales_creditmemo', ['state']), @@ -3760,6 +3853,15 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addIndex( $installer->getIdxName('sales_creditmemo', ['created_at']), ['created_at'] + )->addIndex( + $installer->getIdxName('sales_creditmemo', ['updated_at']), + ['updated_at'] + )->addIndex( + $installer->getIdxName('sales_creditmemo', ['send_email']), + ['send_email'] + )->addIndex( + $installer->getIdxName('sales_creditmemo', ['email_sent']), + ['email_sent'] )->addForeignKey( $installer->getFkName('sales_creditmemo', 'order_id', 'sales_order', 'entity_id'), 'order_id', @@ -3800,6 +3902,12 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con null, [], 'Created At' + )->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Updated At' )->addColumn( 'order_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, @@ -3937,6 +4045,9 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addIndex( $installer->getIdxName('sales_creditmemo_grid', ['created_at']), ['created_at'] + )->addIndex( + $installer->getIdxName('sales_creditmemo_grid', ['updated_at']), + ['updated_at'] )->addIndex( $installer->getIdxName('sales_creditmemo_grid', ['order_created_at']), ['order_created_at'] @@ -4198,7 +4309,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - [], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At' )->addIndex( $installer->getIdxName('sales_creditmemo_comment', ['created_at']), @@ -4596,7 +4707,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - [], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At' )->addIndex( $installer->getIdxName( diff --git a/app/code/Magento/Sales/Setup/UpgradeSchema.php b/app/code/Magento/Sales/Setup/UpgradeSchema.php deleted file mode 100644 index 58d07c9d1bba2..0000000000000 --- a/app/code/Magento/Sales/Setup/UpgradeSchema.php +++ /dev/null @@ -1,229 +0,0 @@ -getConnection(); - 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 - ] - ); - } - } - - if (version_compare($context->getVersion(), '2.0.3') < 0) { - $dropIncrementIndexTables = [ - 'sales_creditmemo', - 'sales_invoice', - 'sales_order', - 'sales_shipment', - 'sales_order_grid', - ]; - foreach ($dropIncrementIndexTables as $table) { - $connection->dropIndex( - $installer->getTable($table), - $installer->getIdxName( - $installer->getTable($table), - ['increment_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ) - ); - } - $createIncrementIndexTables = [ - 'sales_creditmemo', - 'sales_invoice', - 'sales_order', - 'sales_shipment', - 'sales_order_grid', - ]; - foreach ($createIncrementIndexTables as $table) { - $connection->addIndex( - $installer->getTable($table), - $installer->getIdxName( - $installer->getTable($table), - ['increment_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - ['increment_id', 'store_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ); - } - } - - if (version_compare($context->getVersion(), '2.0.4') < 0) { - - /** - * Adding 'send_email' columns. - */ - - $tables = ['sales_order', 'sales_invoice', 'sales_shipment', 'sales_creditmemo']; - - foreach ($tables as $table) { - $table = $setup->getTable($table); - - $setup->getConnection() - ->addColumn( - $table, - 'send_email', - [ - 'type' => Table::TYPE_SMALLINT, - 'after' => 'email_sent', - 'comment' => 'Send Email', - 'unsigned' => true - ] - ); - - $setup->getConnection() - ->addIndex($table, $setup->getIdxName($table, ['email_sent']), 'email_sent'); - - $setup->getConnection() - ->addIndex($table, $setup->getIdxName($table, ['send_email']), 'send_email'); - } - - /** - * Adding 'customer_note' columns. - */ - - $tables = ['sales_invoice', 'sales_shipment', 'sales_creditmemo']; - - foreach ($tables as $table) { - $table = $setup->getTable($table); - - $setup->getConnection() - ->addColumn( - $table, - 'customer_note', - [ - 'type' => Table::TYPE_TEXT, - 'after' => 'updated_at', - 'comment' => 'Customer Note' - ] - ); - } - - /** - * Adding 'customer_note_notify' columns. - */ - - $tables = ['sales_invoice', 'sales_shipment', 'sales_creditmemo']; - - foreach ($tables as $table) { - $table = $setup->getTable($table); - - $setup->getConnection() - ->addColumn( - $table, - 'customer_note_notify', - [ - 'type' => Table::TYPE_SMALLINT, - 'after' => 'customer_note', - 'comment' => 'Customer Note Notify', - 'unsigned' => true - ] - ); - } - } - } -} diff --git a/app/code/Magento/Sales/etc/module.xml b/app/code/Magento/Sales/etc/module.xml index 931f2ab5884d8..294eb87cb2548 100644 --- a/app/code/Magento/Sales/etc/module.xml +++ b/app/code/Magento/Sales/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/SalesSequence/etc/module.xml b/app/code/Magento/SalesSequence/etc/module.xml index c948c4a55aadc..77c87265e8f42 100644 --- a/app/code/Magento/SalesSequence/etc/module.xml +++ b/app/code/Magento/SalesSequence/etc/module.xml @@ -6,6 +6,6 @@ */ --> - + diff --git a/app/code/Magento/Search/Setup/InstallSchema.php b/app/code/Magento/Search/Setup/InstallSchema.php index d58c0da9a8946..34dd3d93895f9 100644 --- a/app/code/Magento/Search/Setup/InstallSchema.php +++ b/app/code/Magento/Search/Setup/InstallSchema.php @@ -115,6 +115,10 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->getIdxName('search_query', 'store_id'), 'store_id' ) + ->addIndex( + $installer->getIdxName('search_query', 'is_processed'), + 'is_processed' + ) ->addIndex( $installer->getIdxName('search_query', 'synonym_for'), 'synonym_for' diff --git a/app/code/Magento/Search/Setup/UpgradeSchema.php b/app/code/Magento/Search/Setup/UpgradeSchema.php deleted file mode 100644 index 461c7fd3d3d23..0000000000000 --- a/app/code/Magento/Search/Setup/UpgradeSchema.php +++ /dev/null @@ -1,49 +0,0 @@ -moduleList = $moduleList; - } - - /** - * Upgrades DB schema for a module - * - * @param SchemaSetupInterface $setup - * @param ModuleContextInterface $context - * @return void - */ - public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) - { - if (version_compare($context->getVersion(), '2.0.0.1') < 0) { - $setup->startSetup(); - $connection = $setup->getConnection(); - $tableName = $setup->getTable('search_query'); - $idxName = $setup->getIdxName('search_query', ['is_processed']); - $connection->addIndex($tableName, $idxName, ['is_processed']); - $setup->endSetup(); - } - } -} diff --git a/app/code/Magento/Search/etc/module.xml b/app/code/Magento/Search/etc/module.xml index 2648b158b5042..8719bbd18c2cf 100644 --- a/app/code/Magento/Search/etc/module.xml +++ b/app/code/Magento/Search/etc/module.xml @@ -7,7 +7,7 @@ --> - + diff --git a/app/code/Magento/TaxImportExport/etc/module.xml b/app/code/Magento/TaxImportExport/etc/module.xml index 64d6d6544460d..3fc38c0ae9612 100644 --- a/app/code/Magento/TaxImportExport/etc/module.xml +++ b/app/code/Magento/TaxImportExport/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Theme/Setup/InstallSchema.php b/app/code/Magento/Theme/Setup/InstallSchema.php index b7f6d0edb3775..c1ed22a79523f 100644 --- a/app/code/Magento/Theme/Setup/InstallSchema.php +++ b/app/code/Magento/Theme/Setup/InstallSchema.php @@ -51,12 +51,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con 255, ['nullable' => true], 'Theme Path' - )->addColumn( - 'theme_version', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Theme Version' )->addColumn( 'theme_title', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, diff --git a/app/code/Magento/Theme/Setup/UpgradeSchema.php b/app/code/Magento/Theme/Setup/UpgradeSchema.php deleted file mode 100644 index 3df76719134e7..0000000000000 --- a/app/code/Magento/Theme/Setup/UpgradeSchema.php +++ /dev/null @@ -1,40 +0,0 @@ -getVersion(), '2.0.1') < 0) { - $installer = $setup; - - $installer->startSetup(); - $connection = $installer->getConnection(); - - /** - * Remove column 'theme_version' from 'core_theme' - */ - $connection->dropColumn( - $installer->getTable('theme'), - 'theme_version' - ); - - $installer->endSetup(); - } - } -} diff --git a/app/code/Magento/Theme/etc/module.xml b/app/code/Magento/Theme/etc/module.xml index e6744b59cb8c2..742926c80c224 100644 --- a/app/code/Magento/Theme/etc/module.xml +++ b/app/code/Magento/Theme/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/User/Setup/InstallSchema.php b/app/code/Magento/User/Setup/InstallSchema.php index abda317b7bc8a..3527f70c4198b 100644 --- a/app/code/Magento/User/Setup/InstallSchema.php +++ b/app/code/Magento/User/Setup/InstallSchema.php @@ -124,7 +124,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addColumn( 'interface_locale', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 5, + 16, ['nullable' => false, 'default' => 'en_US'], 'Backend interface locale' )->addIndex( diff --git a/app/code/Magento/User/Setup/UpgradeSchema.php b/app/code/Magento/User/Setup/UpgradeSchema.php deleted file mode 100644 index bab95673a66a0..0000000000000 --- a/app/code/Magento/User/Setup/UpgradeSchema.php +++ /dev/null @@ -1,47 +0,0 @@ -getConnection(); - if (version_compare($context->getVersion(), '2.0.1') < 0) { - /** - * Modifying length of 'interface_locale' column of admin_user table. - */ - $table = $setup->getTable('admin_user'); - $connection->modifyColumn( - $table, - 'interface_locale', - [ - 'type' => Table::TYPE_TEXT, - 'length' => 16, - 'nullable' => false, - 'default' => 'en_US', - 'comment' => 'Backend interface locale', - ] - ); - } - } -} diff --git a/app/code/Magento/User/etc/module.xml b/app/code/Magento/User/etc/module.xml index 8bb2b470ccf55..d0467cb70e860 100644 --- a/app/code/Magento/User/etc/module.xml +++ b/app/code/Magento/User/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Weee/etc/module.xml b/app/code/Magento/Weee/etc/module.xml index 19658377fc4a7..48f7754d1356e 100644 --- a/app/code/Magento/Weee/etc/module.xml +++ b/app/code/Magento/Weee/etc/module.xml @@ -6,7 +6,7 @@ */ --> - +